On Wed, Apr 12, 2017 at 3:56 PM, Gavin Wahl wrote:
> > Given this limited example I'd probably choose to model notifications as
> an
> > array on the user table. Then just "UPDATE user SET notifications =
> > array['a','b']::text WHERE user_id = 1;
>
> I'm hesitant to ditch
> Given this limited example I'd probably choose to model notifications as an
> array on the user table. Then just "UPDATE user SET notifications =
> array['a','b']::text WHERE user_id = 1;
I'm hesitant to ditch the first normal form just to get around this. Anyway,
there's actually extra data
On Wed, Apr 12, 2017 at 3:32 PM, Gavin Wahl wrote:
> I have a table that stores user notifications:
>
> CREATE TABLE notifications (
> user_id INT,
> type CHAR(1),
> PRIMARY KEY (user_id, type)
> );
> [...]
>
>
> Is there any way to do this correctly without
I have a table that stores user notifications:
CREATE TABLE notifications (
user_id INT,
type CHAR(1),
PRIMARY KEY (user_id, type)
);
When a user edits their notifications, I need to atomically replace the old set
with the new set. My first instinct is to do this:
BEGIN;
DELETE FROM