forked from MirrorHub/mautrix-whatsapp
Fix mixed indent in .sql files
This commit is contained in:
parent
91bab528f3
commit
66cd7cd080
2 changed files with 88 additions and 88 deletions
|
@ -8,7 +8,7 @@ charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
[*.{yaml,yml}]
|
[*.{yaml,yml,sql}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
|
|
||||||
[.gitlab-ci.yml]
|
[.gitlab-ci.yml]
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
CREATE TABLE "user" (
|
CREATE TABLE "user" (
|
||||||
mxid TEXT PRIMARY KEY,
|
mxid TEXT PRIMARY KEY,
|
||||||
username TEXT UNIQUE,
|
username TEXT UNIQUE,
|
||||||
agent SMALLINT,
|
agent SMALLINT,
|
||||||
device SMALLINT,
|
device SMALLINT,
|
||||||
|
|
||||||
management_room TEXT,
|
management_room TEXT,
|
||||||
space_room TEXT,
|
space_room TEXT,
|
||||||
|
@ -28,24 +28,24 @@ CREATE TABLE portal (
|
||||||
first_event_id TEXT,
|
first_event_id TEXT,
|
||||||
next_batch_id TEXT,
|
next_batch_id TEXT,
|
||||||
relay_user_id TEXT,
|
relay_user_id TEXT,
|
||||||
expiration_time BIGINT NOT NULL DEFAULT 0,
|
expiration_time BIGINT NOT NULL DEFAULT 0,
|
||||||
|
|
||||||
PRIMARY KEY (jid, receiver)
|
PRIMARY KEY (jid, receiver)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE puppet (
|
CREATE TABLE puppet (
|
||||||
username TEXT PRIMARY KEY,
|
username TEXT PRIMARY KEY,
|
||||||
displayname TEXT,
|
displayname TEXT,
|
||||||
name_quality SMALLINT,
|
name_quality SMALLINT,
|
||||||
avatar TEXT,
|
avatar TEXT,
|
||||||
avatar_url TEXT,
|
avatar_url TEXT,
|
||||||
|
|
||||||
custom_mxid TEXT,
|
custom_mxid TEXT,
|
||||||
access_token TEXT,
|
access_token TEXT,
|
||||||
next_batch TEXT,
|
next_batch TEXT,
|
||||||
|
|
||||||
enable_presence BOOLEAN NOT NULL DEFAULT true,
|
enable_presence BOOLEAN NOT NULL DEFAULT true,
|
||||||
enable_receipts BOOLEAN NOT NULL DEFAULT true
|
enable_receipts BOOLEAN NOT NULL DEFAULT true
|
||||||
);
|
);
|
||||||
|
|
||||||
-- only: postgres
|
-- only: postgres
|
||||||
|
@ -59,35 +59,35 @@ CREATE TABLE message (
|
||||||
sender TEXT,
|
sender TEXT,
|
||||||
timestamp BIGINT,
|
timestamp BIGINT,
|
||||||
sent BOOLEAN,
|
sent BOOLEAN,
|
||||||
error error_type,
|
error error_type,
|
||||||
type TEXT,
|
type TEXT,
|
||||||
|
|
||||||
broadcast_list_jid TEXT,
|
broadcast_list_jid TEXT,
|
||||||
|
|
||||||
PRIMARY KEY (chat_jid, chat_receiver, jid),
|
PRIMARY KEY (chat_jid, chat_receiver, jid),
|
||||||
FOREIGN KEY (chat_jid, chat_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE
|
FOREIGN KEY (chat_jid, chat_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE reaction (
|
CREATE TABLE reaction (
|
||||||
chat_jid TEXT,
|
chat_jid TEXT,
|
||||||
chat_receiver TEXT,
|
chat_receiver TEXT,
|
||||||
target_jid TEXT,
|
target_jid TEXT,
|
||||||
sender TEXT,
|
sender TEXT,
|
||||||
|
|
||||||
mxid TEXT NOT NULL,
|
mxid TEXT NOT NULL,
|
||||||
jid TEXT NOT NULL,
|
jid TEXT NOT NULL,
|
||||||
|
|
||||||
PRIMARY KEY (chat_jid, chat_receiver, target_jid, sender),
|
PRIMARY KEY (chat_jid, chat_receiver, target_jid, sender),
|
||||||
FOREIGN KEY (chat_jid, chat_receiver, target_jid) REFERENCES message(chat_jid, chat_receiver, jid)
|
FOREIGN KEY (chat_jid, chat_receiver, target_jid) REFERENCES message(chat_jid, chat_receiver, jid)
|
||||||
ON DELETE CASCADE ON UPDATE CASCADE
|
ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE disappearing_message (
|
CREATE TABLE disappearing_message (
|
||||||
room_id TEXT,
|
room_id TEXT,
|
||||||
event_id TEXT,
|
event_id TEXT,
|
||||||
expire_in BIGINT NOT NULL,
|
expire_in BIGINT NOT NULL,
|
||||||
expire_at BIGINT,
|
expire_at BIGINT,
|
||||||
PRIMARY KEY (room_id, event_id)
|
PRIMARY KEY (room_id, event_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE user_portal (
|
CREATE TABLE user_portal (
|
||||||
|
@ -102,80 +102,80 @@ CREATE TABLE user_portal (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE backfill_queue (
|
CREATE TABLE backfill_queue (
|
||||||
queue_id INTEGER PRIMARY KEY
|
queue_id INTEGER PRIMARY KEY
|
||||||
-- only: postgres
|
-- only: postgres
|
||||||
GENERATED ALWAYS AS IDENTITY
|
GENERATED ALWAYS AS IDENTITY
|
||||||
,
|
,
|
||||||
user_mxid TEXT,
|
user_mxid TEXT,
|
||||||
type INTEGER NOT NULL,
|
type INTEGER NOT NULL,
|
||||||
priority INTEGER NOT NULL,
|
priority INTEGER NOT NULL,
|
||||||
portal_jid TEXT,
|
portal_jid TEXT,
|
||||||
portal_receiver TEXT,
|
portal_receiver TEXT,
|
||||||
time_start TIMESTAMP,
|
time_start TIMESTAMP,
|
||||||
dispatch_time TIMESTAMP,
|
dispatch_time TIMESTAMP,
|
||||||
completed_at TIMESTAMP,
|
completed_at TIMESTAMP,
|
||||||
batch_delay INTEGER,
|
batch_delay INTEGER,
|
||||||
max_batch_events INTEGER NOT NULL,
|
max_batch_events INTEGER NOT NULL,
|
||||||
max_total_events INTEGER,
|
max_total_events INTEGER,
|
||||||
|
|
||||||
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE ON UPDATE CASCADE
|
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE backfill_state (
|
CREATE TABLE backfill_state (
|
||||||
user_mxid TEXT,
|
user_mxid TEXT,
|
||||||
portal_jid TEXT,
|
portal_jid TEXT,
|
||||||
portal_receiver TEXT,
|
portal_receiver TEXT,
|
||||||
processing_batch BOOLEAN,
|
processing_batch BOOLEAN,
|
||||||
backfill_complete BOOLEAN,
|
backfill_complete BOOLEAN,
|
||||||
first_expected_ts TIMESTAMP,
|
first_expected_ts TIMESTAMP,
|
||||||
PRIMARY KEY (user_mxid, portal_jid, portal_receiver),
|
PRIMARY KEY (user_mxid, portal_jid, portal_receiver),
|
||||||
FOREIGN KEY (user_mxid) REFERENCES "user" (mxid) ON DELETE CASCADE ON UPDATE CASCADE,
|
FOREIGN KEY (user_mxid) REFERENCES "user" (mxid) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal (jid, receiver) ON DELETE CASCADE
|
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal (jid, receiver) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE media_backfill_requests (
|
CREATE TABLE media_backfill_requests (
|
||||||
user_mxid TEXT,
|
user_mxid TEXT,
|
||||||
portal_jid TEXT,
|
portal_jid TEXT,
|
||||||
portal_receiver TEXT,
|
portal_receiver TEXT,
|
||||||
event_id TEXT,
|
event_id TEXT,
|
||||||
media_key bytea,
|
media_key bytea,
|
||||||
status INTEGER,
|
status INTEGER,
|
||||||
error TEXT,
|
error TEXT,
|
||||||
PRIMARY KEY (user_mxid, portal_jid, portal_receiver, event_id),
|
PRIMARY KEY (user_mxid, portal_jid, portal_receiver, event_id),
|
||||||
FOREIGN KEY (user_mxid) REFERENCES "user"(mxid) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (user_mxid) REFERENCES "user"(mxid) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal(jid, receiver) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal(jid, receiver) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE history_sync_conversation (
|
CREATE TABLE history_sync_conversation (
|
||||||
user_mxid TEXT,
|
user_mxid TEXT,
|
||||||
conversation_id TEXT,
|
conversation_id TEXT,
|
||||||
portal_jid TEXT,
|
portal_jid TEXT,
|
||||||
portal_receiver TEXT,
|
portal_receiver TEXT,
|
||||||
|
|
||||||
last_message_timestamp TIMESTAMP,
|
last_message_timestamp TIMESTAMP,
|
||||||
archived BOOLEAN,
|
archived BOOLEAN,
|
||||||
pinned INTEGER,
|
pinned INTEGER,
|
||||||
mute_end_time TIMESTAMP,
|
mute_end_time TIMESTAMP,
|
||||||
disappearing_mode INTEGER,
|
disappearing_mode INTEGER,
|
||||||
end_of_history_transfer_type INTEGER,
|
end_of_history_transfer_type INTEGER,
|
||||||
ephemeral_Expiration INTEGER,
|
ephemeral_Expiration INTEGER,
|
||||||
marked_as_unread BOOLEAN,
|
marked_as_unread BOOLEAN,
|
||||||
unread_count INTEGER,
|
unread_count INTEGER,
|
||||||
|
|
||||||
PRIMARY KEY (user_mxid, conversation_id),
|
PRIMARY KEY (user_mxid, conversation_id),
|
||||||
FOREIGN KEY (user_mxid) REFERENCES "user"(mxid) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (user_mxid) REFERENCES "user"(mxid) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal(jid, receiver) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal(jid, receiver) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE history_sync_message (
|
CREATE TABLE history_sync_message (
|
||||||
user_mxid TEXT,
|
user_mxid TEXT,
|
||||||
conversation_id TEXT,
|
conversation_id TEXT,
|
||||||
message_id TEXT,
|
message_id TEXT,
|
||||||
timestamp TIMESTAMP,
|
timestamp TIMESTAMP,
|
||||||
data bytea,
|
data bytea,
|
||||||
inserted_time TIMESTAMP,
|
inserted_time TIMESTAMP,
|
||||||
|
|
||||||
PRIMARY KEY (user_mxid, conversation_id, message_id),
|
PRIMARY KEY (user_mxid, conversation_id, message_id),
|
||||||
FOREIGN KEY (user_mxid) REFERENCES "user"(mxid) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (user_mxid) REFERENCES "user"(mxid) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (user_mxid, conversation_id) REFERENCES history_sync_conversation(user_mxid, conversation_id) ON DELETE CASCADE
|
FOREIGN KEY (user_mxid, conversation_id) REFERENCES history_sync_conversation(user_mxid, conversation_id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue