-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ALTER TABLE banned | ||
ALTER COLUMN banned_at TYPE TIMESTAMPTZ USING banned_at::TIMESTAMPTZ, | ||
ALTER COLUMN message_text DROP NOT NULL; | ||
|
||
INSERT INTO banned (message_text, banned_user_id, banned_at, banned_by, message_id, banned_in_chat_id, banned_in_chat_username) | ||
SELECT b.ban_reason | ||
, b.id | ||
, b.banned_at | ||
, vahter.id | ||
, NULL -- don't have it | ||
, NULL -- don't have it | ||
, NULL -- don't have it | ||
FROM "user" b | ||
JOIN "user" vahter ON vahter.id = b.banned_by | ||
WHERE b.ban_reason IS NULL -- missed such messages in the previous migration | ||
AND b.banned_at IS NOT NULL; |