feat(db): add nav_links, social_links, and events tables

- 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
This commit is contained in:
2026-06-06 02:25:49 -04:00
parent f4245a996a
commit 7588ddce1f
17 changed files with 6163 additions and 7 deletions
+28
View File
@@ -0,0 +1,28 @@
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");