Represent channel relationships using paths table

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Max Brunsfeld 2023-08-09 10:36:27 -07:00
parent 498d043a0a
commit 778fd6b0a9
4 changed files with 80 additions and 78 deletions

View file

@ -192,11 +192,11 @@ CREATE TABLE "channels" (
"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 TABLE "channel_paths" (
"id_path" TEXT NOT NULL PRIMARY KEY,
"channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE
);
CREATE INDEX "index_channel_paths_on_channel_id" ON "channel_paths" ("channel_id");
CREATE TABLE "channel_members" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,