-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: messages migration from proteus to mls [WPB-15149] 🍒 (#3219)
* Commit with unresolved merge conflicts * test fixes --------- Co-authored-by: Jakub Żerko <[email protected]> Co-authored-by: Yamil Medina <[email protected]>
- Loading branch information
1 parent
5788184
commit d54cc28
Showing
6 changed files
with
332 additions
and
2 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
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,47 @@ | ||
CREATE TABLE Reaction_temp AS | ||
SELECT * FROM Reaction; | ||
|
||
DROP TABLE Reaction; | ||
|
||
CREATE TABLE Reaction ( | ||
message_id TEXT NOT NULL, | ||
conversation_id TEXT AS QualifiedIDEntity NOT NULL, | ||
sender_id TEXT AS QualifiedIDEntity NOT NULL, | ||
emoji TEXT NOT NULL, | ||
date TEXT NOT NULL, | ||
FOREIGN KEY (message_id, conversation_id) REFERENCES Message(id, conversation_id) ON DELETE CASCADE ON UPDATE CASCADE, | ||
FOREIGN KEY (sender_id) REFERENCES User(qualified_id) ON DELETE CASCADE, | ||
PRIMARY KEY (message_id, conversation_id, sender_id, emoji) | ||
); | ||
|
||
INSERT INTO Reaction(message_id, conversation_id, sender_id, emoji, date) | ||
SELECT message_id, conversation_id, sender_id, emoji, date | ||
FROM Reaction_temp; | ||
|
||
DROP TABLE Reaction_temp; | ||
|
||
CREATE INDEX reaction_sender_index ON Reaction(sender_id); | ||
CREATE INDEX reaction_emoji_index ON Reaction(emoji); | ||
|
||
CREATE TABLE MessageRestrictedAssetContent_temp AS | ||
SELECT * FROM MessageRestrictedAssetContent; | ||
|
||
DROP TABLE MessageRestrictedAssetContent; | ||
|
||
CREATE TABLE MessageRestrictedAssetContent ( | ||
message_id TEXT NOT NULL, | ||
conversation_id TEXT AS QualifiedIDEntity NOT NULL, | ||
|
||
asset_mime_type TEXT NOT NULL, | ||
asset_size INTEGER NOT NULL, | ||
asset_name TEXT NOT NULL, | ||
|
||
FOREIGN KEY (message_id, conversation_id) REFERENCES Message(id, conversation_id) ON DELETE CASCADE ON UPDATE CASCADE, | ||
PRIMARY KEY (message_id, conversation_id) | ||
); | ||
|
||
INSERT INTO MessageRestrictedAssetContent(message_id, conversation_id, asset_mime_type, asset_size, asset_name) | ||
SELECT message_id, conversation_id, asset_mime_type, asset_size, asset_name | ||
FROM MessageRestrictedAssetContent_temp; | ||
|
||
DROP TABLE MessageRestrictedAssetContent_temp; |
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
Oops, something went wrong.