9 lines
624 B
SQL
9 lines
624 B
SQL
CREATE TABLE "lightbox_items" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"editorial_account_id" uuid NOT NULL,
|
|
"asset_id" text NOT NULL,
|
|
"added_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "lightbox_items" ADD CONSTRAINT "lightbox_items_editorial_account_id_editorial_accounts_id_fk" FOREIGN KEY ("editorial_account_id") REFERENCES "public"."editorial_accounts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "lightbox_items_editorial_asset_idx" ON "lightbox_items" USING btree ("editorial_account_id","asset_id"); |