Files
glenloch-media/drizzle/0011_pretty_lilith.sql
2026-11-20 04:07:02 +00:00

16 lines
874 B
SQL

CREATE TABLE "notification_rules" (
"id" text PRIMARY KEY NOT NULL,
"key" text NOT NULL,
"event" text DEFAULT 'assignment.created' NOT NULL,
"offset_days" integer NOT NULL,
"send_at_local_time" text DEFAULT '09:00' NOT NULL,
"channel_set" text DEFAULT 'email' NOT NULL,
"applies_to_service_id" text,
"active" boolean DEFAULT true NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone,
CONSTRAINT "notification_rules_key_unique" UNIQUE("key")
);
--> statement-breakpoint
ALTER TABLE "notification_rules" ADD CONSTRAINT "notification_rules_applies_to_service_id_services_id_fk" FOREIGN KEY ("applies_to_service_id") REFERENCES "public"."services"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "notification_rules_active_idx" ON "notification_rules" USING btree ("active");