platform/server/postgres/migrations/notificationSchema.sql
Denis Bykhov 084eca268e
Extract domain fields (#7075)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
2024-11-01 21:03:43 +05:00

25 lines
507 B
SQL

ALTER TABLE notification
ADD "isViewed" bool,
ADD archived bool,
ADD "user" text;
ALTER TABLE notification
DROP COLUMN "attachedTo";
UPDATE notification
SET "isViewed" = (data->>'isViewed')::boolean;
UPDATE notification
SET "archived" = (data->>'archived')::boolean;
UPDATE notification
SET "user" = (data->>'user');
ALTER TABLE notification
ALTER COLUMN "isViewed" SET NOT NULL;
ALTER TABLE notification
ALTER COLUMN archived SET NOT NULL;
ALTER TABLE notification
ALTER COLUMN "user" SET NOT NULL;