2022-11-11 09:41:44 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS "rooms" (
|
|
|
|
"id" SERIAL PRIMARY KEY,
|
|
|
|
"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-12-09 07:11:18 +00:00
|
|
|
ADD "host_connection_epoch" UUID;
|
2022-12-02 15:30:00 +00:00
|
|
|
CREATE INDEX "index_projects_on_host_connection_epoch" ON "projects" ("host_connection_epoch");
|
2022-11-11 09:41:44 +00:00
|
|
|
|
2022-11-15 15:37:32 +00:00
|
|
|
CREATE TABLE "worktrees" (
|
2022-11-16 09:41:36 +00:00
|
|
|
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
|
2022-12-02 13:22:36 +00:00
|
|
|
"id" INT8 NOT NULL,
|
2022-11-11 09:41:44 +00:00
|
|
|
"root_name" VARCHAR NOT NULL,
|
2022-11-15 15:37:32 +00:00
|
|
|
"abs_path" VARCHAR NOT NULL,
|
|
|
|
"visible" BOOL NOT NULL,
|
2022-11-17 15:56:43 +00:00
|
|
|
"scan_id" INT8 NOT NULL,
|
2022-11-15 15:37:32 +00:00
|
|
|
"is_complete" BOOL NOT NULL,
|
2022-11-11 09:41:44 +00:00
|
|
|
PRIMARY KEY(project_id, id)
|
|
|
|
);
|
|
|
|
CREATE INDEX "index_worktrees_on_project_id" ON "worktrees" ("project_id");
|
|
|
|
|
2022-11-15 15:37:32 +00:00
|
|
|
CREATE TABLE "worktree_entries" (
|
2022-11-15 17:02:07 +00:00
|
|
|
"project_id" INTEGER NOT NULL,
|
2022-12-02 12:58:23 +00:00
|
|
|
"worktree_id" INT8 NOT NULL,
|
2022-12-02 13:22:36 +00:00
|
|
|
"id" INT8 NOT NULL,
|
2022-11-15 15:37:32 +00:00
|
|
|
"is_dir" BOOL NOT NULL,
|
|
|
|
"path" VARCHAR NOT NULL,
|
2022-11-17 15:56:43 +00:00
|
|
|
"inode" INT8 NOT NULL,
|
2022-12-02 12:58:23 +00:00
|
|
|
"mtime_seconds" INT8 NOT NULL,
|
2022-11-15 15:37:32 +00:00
|
|
|
"mtime_nanos" INTEGER NOT NULL,
|
|
|
|
"is_symlink" BOOL NOT NULL,
|
|
|
|
"is_ignored" BOOL NOT NULL,
|
2022-11-15 17:02:07 +00:00
|
|
|
PRIMARY KEY(project_id, worktree_id, id),
|
2022-11-16 09:41:36 +00:00
|
|
|
FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE
|
2022-11-15 15:37:32 +00:00
|
|
|
);
|
2022-12-02 12:58:23 +00:00
|
|
|
CREATE INDEX "index_worktree_entries_on_project_id" ON "worktree_entries" ("project_id");
|
2022-11-15 15:37:32 +00:00
|
|
|
CREATE INDEX "index_worktree_entries_on_project_id_and_worktree_id" ON "worktree_entries" ("project_id", "worktree_id");
|
|
|
|
|
|
|
|
CREATE TABLE "worktree_diagnostic_summaries" (
|
2022-11-15 17:02:07 +00:00
|
|
|
"project_id" INTEGER NOT NULL,
|
2022-12-02 13:22:36 +00:00
|
|
|
"worktree_id" INT8 NOT NULL,
|
2022-11-16 14:48:26 +00:00
|
|
|
"path" VARCHAR NOT NULL,
|
2022-12-02 13:22:36 +00:00
|
|
|
"language_server_id" INT8 NOT NULL,
|
2022-11-15 15:37:32 +00:00
|
|
|
"error_count" INTEGER NOT NULL,
|
|
|
|
"warning_count" INTEGER NOT NULL,
|
2022-11-15 17:02:07 +00:00
|
|
|
PRIMARY KEY(project_id, worktree_id, path),
|
2022-11-16 09:41:36 +00:00
|
|
|
FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE
|
2022-11-15 15:37:32 +00:00
|
|
|
);
|
2022-12-02 12:58:23 +00:00
|
|
|
CREATE INDEX "index_worktree_diagnostic_summaries_on_project_id" ON "worktree_diagnostic_summaries" ("project_id");
|
2022-11-15 15:37:32 +00:00
|
|
|
CREATE INDEX "index_worktree_diagnostic_summaries_on_project_id_and_worktree_id" ON "worktree_diagnostic_summaries" ("project_id", "worktree_id");
|
|
|
|
|
|
|
|
CREATE TABLE "language_servers" (
|
2022-11-16 09:41:36 +00:00
|
|
|
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
|
2022-12-02 13:22:36 +00:00
|
|
|
"id" INT8 NOT NULL,
|
2022-11-15 15:37:32 +00:00
|
|
|
"name" VARCHAR NOT NULL,
|
|
|
|
PRIMARY KEY(project_id, id)
|
|
|
|
);
|
|
|
|
CREATE INDEX "index_language_servers_on_project_id" ON "language_servers" ("project_id");
|
|
|
|
|
2022-11-15 17:02:07 +00:00
|
|
|
CREATE TABLE "project_collaborators" (
|
2022-11-17 14:34:12 +00:00
|
|
|
"id" SERIAL PRIMARY KEY,
|
2022-11-16 09:41:36 +00:00
|
|
|
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
|
2022-11-15 17:02:07 +00:00
|
|
|
"connection_id" INTEGER NOT NULL,
|
2022-12-02 15:30:00 +00:00
|
|
|
"connection_epoch" UUID NOT NULL,
|
2022-11-15 17:02:07 +00:00
|
|
|
"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");
|
|
|
|
CREATE UNIQUE INDEX "index_project_collaborators_on_project_id_and_replica_id" ON "project_collaborators" ("project_id", "replica_id");
|
2022-12-02 15:30:00 +00:00
|
|
|
CREATE INDEX "index_project_collaborators_on_connection_epoch" ON "project_collaborators" ("connection_epoch");
|
2022-11-15 17:02:07 +00:00
|
|
|
|
|
|
|
CREATE TABLE "room_participants" (
|
2022-11-17 14:34:12 +00:00
|
|
|
"id" SERIAL PRIMARY KEY,
|
2022-11-11 09:41:44 +00:00
|
|
|
"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-12-02 15:30:00 +00:00
|
|
|
"answering_connection_epoch" UUID,
|
2022-11-11 09:41:44 +00:00
|
|
|
"location_kind" INTEGER,
|
2022-12-05 14:16:06 +00:00
|
|
|
"location_project_id" INTEGER,
|
|
|
|
"initial_project_id" INTEGER,
|
2022-11-11 18:36:20 +00:00
|
|
|
"calling_user_id" INTEGER NOT NULL REFERENCES users (id),
|
2022-12-02 15:30:00 +00:00
|
|
|
"calling_connection_id" INTEGER NOT NULL,
|
|
|
|
"calling_connection_epoch" UUID 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");
|
2022-12-02 15:30:00 +00:00
|
|
|
CREATE INDEX "index_room_participants_on_answering_connection_epoch" ON "room_participants" ("answering_connection_epoch");
|
|
|
|
CREATE INDEX "index_room_participants_on_calling_connection_epoch" ON "room_participants" ("calling_connection_epoch");
|