diff options
author | Vitaly Takmazov | 2023-02-03 06:39:25 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-02-03 06:39:25 +0300 |
commit | 89f20b0ff36c8413adc2aa9e3c5226ae2eed2101 (patch) | |
tree | fe56fa9f8de597ff313c334b69ffafe5adf0b95d /src/main/resources/db | |
parent | 73b8c2dc544df207d8c7b9e36d20955ff1d88577 (diff) |
messages_txt -> messages
Diffstat (limited to 'src/main/resources/db')
-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 |