2022-11-11 09:41:44 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS "rooms" (
|
|
|
|
"id" SERIAL PRIMARY KEY,
|
|
|
|
"version" INTEGER NOT NULL,
|
|
|
|
"live_kit_room" VARCHAR NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
ALTER TABLE "projects"
|
|
|
|
ADD "room_id" INTEGER REFERENCES rooms (id),
|
2022-11-14 09:13:36 +00:00
|
|
|
ADD "host_connection_id" INTEGER,
|
2022-11-11 09:41:44 +00:00
|
|
|
DROP COLUMN "unregistered";
|
|
|
|
|
|
|
|
CREATE TABLE "project_collaborators" (
|
|
|
|
"id" SERIAL PRIMARY KEY,
|
2022-11-11 15:59:54 +00:00
|
|
|
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
|
2022-11-11 09:41:44 +00:00
|
|
|
"connection_id" INTEGER NOT NULL,
|
|
|
|
"user_id" INTEGER NOT NULL,
|
|
|
|
"replica_id" INTEGER NOT NULL,
|
|
|
|
"is_host" BOOLEAN NOT NULL
|
|
|
|
);
|
|
|
|
CREATE INDEX "index_project_collaborators_on_project_id" ON "project_collaborators" ("project_id");
|
2022-11-15 09:41:21 +00:00
|
|
|
CREATE UNIQUE INDEX "index_project_collaborators_on_project_id_and_replica_id" ON "project_collaborators" ("project_id", "replica_id");
|
2022-11-11 09:41:44 +00:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS "worktrees" (
|
|
|
|
"id" INTEGER NOT NULL,
|
2022-11-11 15:59:54 +00:00
|
|
|
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
|
2022-11-11 09:41:44 +00:00
|
|
|
"root_name" VARCHAR NOT NULL,
|
|
|
|
PRIMARY KEY(project_id, id)
|
|
|
|
);
|
|
|
|
CREATE INDEX "index_worktrees_on_project_id" ON "worktrees" ("project_id");
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS "room_participants" (
|
|
|
|
"id" SERIAL PRIMARY KEY,
|
|
|
|
"room_id" INTEGER NOT NULL REFERENCES rooms (id),
|
|
|
|
"user_id" INTEGER NOT NULL REFERENCES users (id),
|
2022-11-14 09:13:36 +00:00
|
|
|
"answering_connection_id" INTEGER,
|
2022-11-11 09:41:44 +00:00
|
|
|
"location_kind" INTEGER,
|
2022-11-11 14:22:04 +00:00
|
|
|
"location_project_id" INTEGER REFERENCES projects (id),
|
|
|
|
"initial_project_id" INTEGER REFERENCES projects (id),
|
2022-11-11 18:36:20 +00:00
|
|
|
"calling_user_id" INTEGER NOT NULL REFERENCES users (id),
|
|
|
|
"calling_connection_id" INTEGER NOT NULL
|
2022-11-11 09:41:44 +00:00
|
|
|
);
|
2022-11-11 14:22:04 +00:00
|
|
|
CREATE UNIQUE INDEX "index_room_participants_on_user_id" ON "room_participants" ("user_id");
|