From 985f02eb17977dd582a5092b20bffbf8d02990b9 Mon Sep 17 00:00:00 2001 From: Saleel Date: Mon, 13 Nov 2023 22:45:23 +0300 Subject: [PATCH] chore: update sql seed file --- database/seed.sql | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/database/seed.sql b/database/seed.sql index c4326d27..3ad19d09 100644 --- a/database/seed.sql +++ b/database/seed.sql @@ -27,9 +27,15 @@ CREATE TABLE groups ( CREATE TABLE members ( id character varying PRIMARY KEY, - created_at timestamp without time zone NOT NULL DEFAULT now(), - group_id character varying(32) REFERENCES groups(id), - CONSTRAINT "UQ_db97b66d973228a2049c76f89e2" UNIQUE (id, group_id) + created_at timestamp without time zone NOT NULL DEFAULT now() +); + +-- Table Definition ---------------------------------------------- + +CREATE TABLE memberships ( + "group" character varying(32) REFERENCES groups(id), + member character varying REFERENCES members(id), + CONSTRAINT "PK_91a108ed26822c9aaf95c5ed30e" PRIMARY KEY ("group", member) ); -- Table Definition ---------------------------------------------- @@ -54,3 +60,6 @@ ALTER TABLE "groups" ADD FOREIGN KEY ("admin_id") REFERENCES "admins" ("id"); ALTER TABLE "members" ADD FOREIGN KEY ("group_id") REFERENCES "groups" ("id"); ALTER TABLE "invites" ADD FOREIGN KEY ("group_id") REFERENCES "groups" ("id"); ALTER TABLE "oauth_accounts" ADD FOREIGN KEY ("group_id") REFERENCES "groups" ("id"); + +CREATE INDEX "IDX_98688b164e38f522c6b4ade701" ON memberships("group" text_ops); +CREATE INDEX "IDX_772286a3c5154724324fd55eaf" ON memberships(member text_ops); \ No newline at end of file