fix migration sql

master
Aevann 2024-03-27 00:42:06 +02:00
parent 31622cb4aa
commit af82ab78e7
1 changed files with 3 additions and 1 deletions

View File

@ -1,8 +1,10 @@
alter table chat_memberships add column notification bool not null default false;
alter table chat_memberships alter column notification drop default;
alter table chat_memberships add column last_notified int not null default 0;
alter table chat_memberships add column last_notified int default 0;
update chat_memberships a set last_notified=(select created_utc from chat_messages b where a.chat_id=b.chat_id order by created_utc desc limit 1);
update chat_memberships set last_notified=0 where last_notified is null;
alter table chat_memberships alter column last_notified set not null;
alter table chat_memberships alter column last_notified drop default;
drop table chat_notifications;