Skip to content

Commit 5e7d059

Browse files
committed
feat: allow individuals and orgs to create their own publishers
1 parent 72d0c89 commit 5e7d059

File tree

10 files changed

+2697
-70
lines changed

10 files changed

+2697
-70
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ALTER TABLE "publisher" DROP CONSTRAINT "publisher_user_id_user_id_fk";
2+
--> statement-breakpoint
3+
ALTER TABLE "publisher" ALTER COLUMN "user_id" DROP NOT NULL;--> statement-breakpoint
4+
ALTER TABLE "publisher" ADD COLUMN "org_id" text;--> statement-breakpoint
5+
ALTER TABLE "publisher" ADD COLUMN "created_by" text NOT NULL;--> statement-breakpoint
6+
DO $$ BEGIN
7+
ALTER TABLE "publisher" ADD CONSTRAINT "publisher_org_id_org_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."org"("id") ON DELETE no action ON UPDATE no action;
8+
EXCEPTION
9+
WHEN duplicate_object THEN null;
10+
END $$;
11+
--> statement-breakpoint
12+
DO $$ BEGIN
13+
ALTER TABLE "publisher" ADD CONSTRAINT "publisher_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;
14+
EXCEPTION
15+
WHEN duplicate_object THEN null;
16+
END $$;
17+
--> statement-breakpoint
18+
DO $$ BEGIN
19+
ALTER TABLE "publisher" ADD CONSTRAINT "publisher_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;
20+
EXCEPTION
21+
WHEN duplicate_object THEN null;
22+
END $$;

0 commit comments

Comments
 (0)