Files
the-collective-hub/drizzle/0002_brief_proemial_gods.sql
T
zasderq 7588ddce1f 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
2026-06-06 02:25:49 -04:00

21 lines
1.0 KiB
SQL

CREATE TABLE "events" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"site_id" uuid NOT NULL,
"title" text NOT NULL,
"description" text,
"event_type" text DEFAULT 'screening' NOT NULL,
"start_time" timestamp with time zone NOT NULL,
"end_time" timestamp with time zone,
"timezone" text DEFAULT 'America/New_York' NOT NULL,
"location" text,
"external_link" text,
"image_cdn_key" text,
"is_published" boolean DEFAULT false NOT NULL,
"is_recurring" boolean DEFAULT false 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 "events" ADD CONSTRAINT "events_site_id_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "public"."sites"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "events_site_start_idx" ON "events" USING btree ("site_id","start_time");--> statement-breakpoint
CREATE INDEX "events_site_published_idx" ON "events" USING btree ("site_id","is_published");