1
0
Fork 0
out-of-your-element-fork-th.../db/migrations/0001-schema.sql

93 lines
2.1 KiB
MySQL
Raw Normal View History

2023-09-30 12:24:05 +00:00
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "sim" (
2023-09-19 03:55:05 +00:00
"discord_id" TEXT NOT NULL,
"sim_name" TEXT NOT NULL UNIQUE,
2023-09-19 03:55:05 +00:00
"localpart" TEXT NOT NULL,
"mxid" TEXT NOT NULL,
PRIMARY KEY("discord_id")
);
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "webhook" (
2023-09-19 03:55:05 +00:00
"channel_id" TEXT NOT NULL,
"webhook_id" TEXT NOT NULL,
"webhook_token" TEXT NOT NULL,
PRIMARY KEY("channel_id")
);
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "sim_member" (
"mxid" TEXT NOT NULL,
"room_id" TEXT NOT NULL,
"profile_event_content_hash" BLOB,
PRIMARY KEY("room_id","mxid")
) WITHOUT ROWID;
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "member_cache" (
"room_id" TEXT NOT NULL,
"mxid" TEXT NOT NULL,
"displayname" TEXT,
"avatar_url" TEXT,
PRIMARY KEY("room_id","mxid")
) WITHOUT ROWID;
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "file" (
"discord_url" TEXT NOT NULL,
"mxc_url" TEXT NOT NULL,
PRIMARY KEY("discord_url")
) WITHOUT ROWID;
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "guild_space" (
"guild_id" TEXT NOT NULL,
"space_id" TEXT NOT NULL,
PRIMARY KEY("guild_id")
) WITHOUT ROWID;
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "channel_room" (
"channel_id" TEXT NOT NULL,
"room_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"nick" TEXT,
"thread_parent" TEXT,
"custom_avatar" TEXT,
PRIMARY KEY("channel_id","room_id")
);
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "message_channel" (
"message_id" TEXT NOT NULL,
"channel_id" TEXT NOT NULL,
PRIMARY KEY("message_id")
) WITHOUT ROWID;
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "event_message" (
"event_id" TEXT NOT NULL,
"message_id" TEXT NOT NULL,
"event_type" TEXT,
"event_subtype" TEXT,
"part" INTEGER NOT NULL,
"source" INTEGER NOT NULL,
PRIMARY KEY("message_id","event_id")
) WITHOUT ROWID;
2023-09-29 04:41:11 +00:00
2023-09-10 09:36:39 +00:00
CREATE TABLE IF NOT EXISTS "lottie" (
"id" TEXT NOT NULL,
"mxc" TEXT NOT NULL,
PRIMARY KEY("id")
) WITHOUT ROWID;
2023-09-29 04:41:11 +00:00
2023-09-19 03:55:05 +00:00
CREATE TABLE IF NOT EXISTS "emoji" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
2023-09-19 03:55:05 +00:00
"animated" INTEGER NOT NULL,
"mxc_url" TEXT NOT NULL,
PRIMARY KEY("id")
2023-09-19 03:55:05 +00:00
) WITHOUT ROWID;
2023-09-29 04:41:11 +00:00
CREATE TABLE IF NOT EXISTS "reaction" (
"hashed_event_id" INTEGER NOT NULL,
"message_id" TEXT NOT NULL,
"encoded_emoji" TEXT NOT NULL,
PRIMARY KEY ("hashed_event_id")
) WITHOUT ROWID;
2023-09-30 12:24:05 +00:00
COMMIT;