@commonpub/schema 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ CREATE TYPE "public"."contest_visibility" AS ENUM('public', 'unlisted', 'private');--> statement-breakpoint
2
+ CREATE TABLE "contest_stakeholders" (
3
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
4
+ "contest_id" uuid NOT NULL,
5
+ "user_id" uuid NOT NULL,
6
+ "invited_at" timestamp with time zone DEFAULT now() NOT NULL,
7
+ CONSTRAINT "uq_contest_stakeholders_contest_user" UNIQUE("contest_id","user_id")
8
+ );
9
+ --> statement-breakpoint
10
+ ALTER TABLE "contests" ADD COLUMN "visibility" "contest_visibility" DEFAULT 'public' NOT NULL;--> statement-breakpoint
11
+ ALTER TABLE "contests" ADD COLUMN "visible_to_roles" jsonb;--> statement-breakpoint
12
+ ALTER TABLE "contest_stakeholders" ADD CONSTRAINT "contest_stakeholders_contest_id_contests_id_fk" FOREIGN KEY ("contest_id") REFERENCES "public"."contests"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
13
+ ALTER TABLE "contest_stakeholders" ADD CONSTRAINT "contest_stakeholders_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
14
+ CREATE INDEX "idx_contest_stakeholders_contest_id" ON "contest_stakeholders" USING btree ("contest_id");--> statement-breakpoint
15
+ CREATE INDEX "idx_contest_stakeholders_user_id" ON "contest_stakeholders" USING btree ("user_id");