7588ddce1f
- Add nav_links table with siteId, label, url, position, sortOrder, isExternal - Add social_links table with siteId, platform, label, url, icon, sortOrder - Add events table with siteId, title, description, eventType, startTime, endTime, timezone, location, externalLink, imageCdnKey, isPublished, isRecurring - Include corresponding Drizzle migration entries
28 lines
1.4 KiB
SQL
28 lines
1.4 KiB
SQL
CREATE TABLE "nav_links" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"site_id" uuid NOT NULL,
|
|
"label" text NOT NULL,
|
|
"url" text NOT NULL,
|
|
"position" text DEFAULT 'header' NOT NULL,
|
|
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
"is_external" boolean DEFAULT true NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "social_links" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"site_id" uuid NOT NULL,
|
|
"platform" text NOT NULL,
|
|
"label" text,
|
|
"url" text NOT NULL,
|
|
"icon" text,
|
|
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "nav_links" ADD CONSTRAINT "nav_links_site_id_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "public"."sites"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "social_links" ADD CONSTRAINT "social_links_site_id_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "public"."sites"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "nav_links_site_position_order_idx" ON "nav_links" USING btree ("site_id","position","sort_order");--> statement-breakpoint
|
|
CREATE INDEX "social_links_site_order_idx" ON "social_links" USING btree ("site_id","sort_order"); |