forked from mirror/mautrix-discord
Switch to spaces in .sql files
This commit is contained in:
parent
a40ad4d10f
commit
888731cec2
2 changed files with 59 additions and 59 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]
|
||||||
|
|
|
@ -1,105 +1,105 @@
|
||||||
-- v1: Initial revision
|
-- v1: Initial revision
|
||||||
|
|
||||||
CREATE TABLE portal (
|
CREATE TABLE portal (
|
||||||
channel_id TEXT,
|
channel_id TEXT,
|
||||||
receiver TEXT,
|
receiver TEXT,
|
||||||
mxid TEXT UNIQUE,
|
mxid TEXT UNIQUE,
|
||||||
|
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
topic TEXT NOT NULL,
|
topic TEXT NOT NULL,
|
||||||
|
|
||||||
avatar TEXT NOT NULL,
|
avatar TEXT NOT NULL,
|
||||||
avatar_url TEXT,
|
avatar_url TEXT,
|
||||||
|
|
||||||
encrypted BOOLEAN NOT NULL DEFAULT false,
|
encrypted BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
|
||||||
type INT,
|
type INT,
|
||||||
dmuser TEXT,
|
dmuser TEXT,
|
||||||
|
|
||||||
first_event_id TEXT,
|
first_event_id TEXT,
|
||||||
|
|
||||||
PRIMARY KEY (channel_id, receiver)
|
PRIMARY KEY (channel_id, receiver)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE puppet (
|
CREATE TABLE puppet (
|
||||||
id TEXT PRIMARY KEY,
|
id TEXT PRIMARY KEY,
|
||||||
display_name TEXT,
|
display_name TEXT,
|
||||||
|
|
||||||
avatar TEXT,
|
avatar TEXT,
|
||||||
avatar_url TEXT,
|
avatar_url 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,
|
||||||
|
|
||||||
custom_mxid TEXT,
|
custom_mxid TEXT,
|
||||||
access_token TEXT,
|
access_token TEXT,
|
||||||
next_batch TEXT
|
next_batch TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE "user" (
|
CREATE TABLE "user" (
|
||||||
mxid TEXT PRIMARY KEY,
|
mxid TEXT PRIMARY KEY,
|
||||||
id TEXT UNIQUE,
|
id TEXT UNIQUE,
|
||||||
|
|
||||||
management_room TEXT,
|
management_room TEXT,
|
||||||
|
|
||||||
token TEXT
|
token TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE message (
|
CREATE TABLE message (
|
||||||
channel_id TEXT NOT NULL,
|
channel_id TEXT NOT NULL,
|
||||||
receiver TEXT NOT NULL,
|
receiver TEXT NOT NULL,
|
||||||
|
|
||||||
discord_message_id TEXT NOT NULL,
|
discord_message_id TEXT NOT NULL,
|
||||||
matrix_message_id TEXT NOT NULL UNIQUE,
|
matrix_message_id TEXT NOT NULL UNIQUE,
|
||||||
|
|
||||||
author_id TEXT NOT NULL,
|
author_id TEXT NOT NULL,
|
||||||
timestamp BIGINT NOT NULL,
|
timestamp BIGINT NOT NULL,
|
||||||
|
|
||||||
PRIMARY KEY(discord_message_id, channel_id, receiver),
|
PRIMARY KEY(discord_message_id, channel_id, receiver),
|
||||||
FOREIGN KEY(channel_id, receiver) REFERENCES portal(channel_id, receiver) ON DELETE CASCADE
|
FOREIGN KEY(channel_id, receiver) REFERENCES portal(channel_id, receiver) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE reaction (
|
CREATE TABLE reaction (
|
||||||
channel_id TEXT NOT NULL,
|
channel_id TEXT NOT NULL,
|
||||||
receiver TEXT NOT NULL,
|
receiver TEXT NOT NULL,
|
||||||
|
|
||||||
discord_message_id TEXT NOT NULL,
|
discord_message_id TEXT NOT NULL,
|
||||||
matrix_event_id TEXT NOT NULL UNIQUE,
|
matrix_event_id TEXT NOT NULL UNIQUE,
|
||||||
|
|
||||||
author_id TEXT NOT NULL,
|
author_id TEXT NOT NULL,
|
||||||
|
|
||||||
matrix_name TEXT,
|
matrix_name TEXT,
|
||||||
matrix_url TEXT,
|
matrix_url TEXT,
|
||||||
|
|
||||||
discord_id TEXT,
|
discord_id TEXT,
|
||||||
|
|
||||||
UNIQUE (discord_id, author_id, discord_message_id, channel_id, receiver),
|
UNIQUE (discord_id, author_id, discord_message_id, channel_id, receiver),
|
||||||
FOREIGN KEY(channel_id, receiver) REFERENCES portal(channel_id, receiver) ON DELETE CASCADE
|
FOREIGN KEY(channel_id, receiver) REFERENCES portal(channel_id, receiver) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE attachment (
|
CREATE TABLE attachment (
|
||||||
channel_id TEXT NOT NULL,
|
channel_id TEXT NOT NULL,
|
||||||
receiver TEXT NOT NULL,
|
receiver TEXT NOT NULL,
|
||||||
|
|
||||||
discord_message_id TEXT NOT NULL,
|
discord_message_id TEXT NOT NULL,
|
||||||
discord_attachment_id TEXT NOT NULL,
|
discord_attachment_id TEXT NOT NULL,
|
||||||
|
|
||||||
matrix_event_id TEXT NOT NULL UNIQUE,
|
matrix_event_id TEXT NOT NULL UNIQUE,
|
||||||
|
|
||||||
PRIMARY KEY(discord_attachment_id, matrix_event_id),
|
PRIMARY KEY(discord_attachment_id, matrix_event_id),
|
||||||
FOREIGN KEY(channel_id, receiver) REFERENCES portal(channel_id, receiver) ON DELETE CASCADE
|
FOREIGN KEY(channel_id, receiver) REFERENCES portal(channel_id, receiver) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE emoji (
|
CREATE TABLE emoji (
|
||||||
discord_id TEXT PRIMARY KEY,
|
discord_id TEXT PRIMARY KEY,
|
||||||
discord_name TEXT,
|
discord_name TEXT,
|
||||||
matrix_url TEXT
|
matrix_url TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE guild (
|
CREATE TABLE guild (
|
||||||
discord_id TEXT NOT NULL,
|
discord_id TEXT NOT NULL,
|
||||||
guild_id TEXT NOT NULL,
|
guild_id TEXT NOT NULL,
|
||||||
guild_name TEXT NOT NULL,
|
guild_name TEXT NOT NULL,
|
||||||
bridge BOOLEAN DEFAULT FALSE,
|
bridge BOOLEAN DEFAULT FALSE,
|
||||||
PRIMARY KEY(discord_id, guild_id)
|
PRIMARY KEY(discord_id, guild_id)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue