Files

22 lines
1009 B
SQL
Raw Permalink Normal View History

CREATE TABLE "site_config_revisions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"site_id" uuid NOT NULL,
"version" integer NOT NULL,
"data" jsonb NOT NULL,
"checksum" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "sites" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"key" text NOT NULL,
"name" text NOT NULL,
"default_locale" text NOT NULL,
"production_origin" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "sites_key_unique" UNIQUE("key")
);
--> statement-breakpoint
ALTER TABLE "site_config_revisions" ADD CONSTRAINT "site_config_revisions_site_id_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "public"."sites"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "site_config_rev_uq" ON "site_config_revisions" USING btree ("site_id","version");