diff options
Diffstat (limited to 'src/main/resources/db/migration')
-rw-r--r-- | src/main/resources/db/migration/V1.43__merge_messages_txt.sql | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/resources/db/migration/V1.43__merge_messages_txt.sql b/src/main/resources/db/migration/V1.43__merge_messages_txt.sql new file mode 100644 index 00000000..fb43420d --- /dev/null +++ b/src/main/resources/db/migration/V1.43__merge_messages_txt.sql @@ -0,0 +1,8 @@ +ALTER TABLE messages ADD COLUMN txt TEXT; +ALTER TABLE messages ADD COLUMN repliesby TEXT; +ALTER TABLE messages ADD COLUMN updated_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE replies ALTER updated_at TYPE timestamptz USING updated_at AT TIME ZONE 'UTC'; +UPDATE messages +SET txt=m.txt, repliesby=m.repliesby, updated_at=m.updated_at +FROM (SELECT message_id id, txt, repliesby, updated_at AT TIME ZONE 'UTC' updated_at FROM messages_txt) m +WHERE message_id=m.id
\ No newline at end of file |