This commit is contained in:
Max Brunsfeld 2023-07-26 17:20:43 -07:00 committed by Mikayla Maki
parent 40c293e184
commit bb70901e71
No known key found for this signature in database
9 changed files with 310 additions and 9 deletions

View file

@ -184,3 +184,29 @@ CREATE UNIQUE INDEX
"index_followers_on_project_id_and_leader_connection_server_id_and_leader_connection_id_and_follower_connection_server_id_and_follower_connection_id"
ON "followers" ("project_id", "leader_connection_server_id", "leader_connection_id", "follower_connection_server_id", "follower_connection_id");
CREATE INDEX "index_followers_on_room_id" ON "followers" ("room_id");
CREATE TABLE "channels" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
-- "id_path" TEXT NOT NULL,
"name" VARCHAR NOT NULL,
"room_id" INTEGER REFERENCES rooms (id) ON DELETE SET NULL,
"created_at" TIMESTAMP NOT NULL DEFAULT now
)
CREATE TABLE "channel_parents" (
"child_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
"parent_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
PRIMARY KEY(child_id, parent_id)
)
-- CREATE UNIQUE INDEX "index_channels_on_id_path" ON "channels" ("id_path");
CREATE TABLE "channel_members" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
"user_id" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
"admin" BOOLEAN NOT NULL DEFAULT false,
"updated_at" TIMESTAMP NOT NULL DEFAULT now
)
CREATE UNIQUE INDEX "index_channel_members_on_channel_id_and_user_id" ON "channel_members" ("channel_id", "user_id");