How should I store checkbox values in postgres
let say I have a checkbox list called
and later on users will be able to change interests. lets say user unchecked hiking, new put request will be like this
how should I store this data? seperate table?, simple array column?
If I create seperate table, schema will be like this
id: uuid
userId: uuid reference user id
interest: interest enum
so when user send put request what should I do?
delete all existing interests and insert new ones?
is this normal way? sorry i am a sql noob
interests and user checked some options. They will send request like this:interests: ['cars', 'hiking', 'dance']and later on users will be able to change interests. lets say user unchecked hiking, new put request will be like this
interests: ['cars', 'dance']how should I store this data? seperate table?, simple array column?
If I create seperate table, schema will be like this
id: uuid
userId: uuid reference user id
interest: interest enum
so when user send put request what should I do?
delete all existing interests and insert new ones?
is this normal way? sorry i am a sql noob