-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db: fix upgrades when creating from scratch
Signed-off-by: Sumner Evans <[email protected]>
- Loading branch information
1 parent
cf0fe10
commit bdd548e
Showing
3 changed files
with
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
-- v0 -> v2: Latest revision | ||
|
||
CREATE TABLE IF NOT EXISTS user_filter_ids ( | ||
user_id VARCHAR(255) PRIMARY KEY, | ||
filter_id VARCHAR(255) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS user_batch_tokens ( | ||
user_id VARCHAR(255) PRIMARY KEY, | ||
next_batch_token VARCHAR(255) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS rooms ( | ||
room_id VARCHAR(255) PRIMARY KEY, | ||
encryption_event VARCHAR(65535) NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS room_members ( | ||
room_id VARCHAR(255), | ||
user_id VARCHAR(255), | ||
PRIMARY KEY (room_id, user_id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS chatwoot_conversation_to_matrix_room ( | ||
matrix_room_id VARCHAR(255) UNIQUE, | ||
chatwoot_conversation_id INTEGER UNIQUE, | ||
PRIMARY KEY (matrix_room_id, chatwoot_conversation_id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS chatwoot_message_to_matrix_event ( | ||
matrix_event_id VARCHAR(255) UNIQUE, | ||
chatwoot_message_id INTEGER, | ||
PRIMARY KEY (matrix_event_id, chatwoot_message_id) | ||
); | ||
|
||
ALTER TABLE chatwoot_conversation_to_matrix_room | ||
ADD COLUMN IF NOT EXISTS most_recent_event_id VARCHAR(255); | ||
|
||
ALTER TABLE chatwoot_message_to_matrix_event | ||
DROP CONSTRAINT IF EXISTS chatwoot_message_to_matrix_event_matrix_event_id_key; |
File renamed without changes.
File renamed without changes.