push to maple-street

This commit is contained in:
Tiel Coder
2026-11-20 04:07:02 +00:00
parent 2cec220a24
commit 5adf1cef1f
345 changed files with 86105 additions and 1079 deletions
+37
View File
@@ -0,0 +1,37 @@
CREATE TABLE "notifications" (
"id" text PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"channel" text DEFAULT 'email' NOT NULL,
"template_key" text NOT NULL,
"rule_key" text,
"assignment_id" text,
"slot_id" text,
"to_address" text NOT NULL,
"payload_json" text DEFAULT '' NOT NULL,
"dedupe_key" text NOT NULL,
"scheduled_for" timestamp with time zone DEFAULT now() NOT NULL,
"status" text DEFAULT 'queued' NOT NULL,
"attempts" integer DEFAULT 0 NOT NULL,
"provider_id" text,
"provider_status" text,
"error" text,
"sent_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone,
CONSTRAINT "notifications_dedupe_key_unique" UNIQUE("dedupe_key")
);
--> statement-breakpoint
CREATE TABLE "used_tokens" (
"jti" text PRIMARY KEY NOT NULL,
"assignment_id" text NOT NULL,
"action" text NOT NULL,
"used_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_assignment_id_assignments_id_fk" FOREIGN KEY ("assignment_id") REFERENCES "public"."assignments"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_slot_id_slots_id_fk" FOREIGN KEY ("slot_id") REFERENCES "public"."slots"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "used_tokens" ADD CONSTRAINT "used_tokens_assignment_id_assignments_id_fk" FOREIGN KEY ("assignment_id") REFERENCES "public"."assignments"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "notifications_status_scheduled_idx" ON "notifications" USING btree ("status","scheduled_for");--> statement-breakpoint
CREATE INDEX "notifications_user_idx" ON "notifications" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX "notifications_assignment_idx" ON "notifications" USING btree ("assignment_id");
+16
View File
@@ -0,0 +1,16 @@
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");
+30
View File
@@ -0,0 +1,30 @@
CREATE TABLE "app_settings" (
"key" text PRIMARY KEY NOT NULL,
"value" text NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "training_lessons" (
"id" text PRIMARY KEY NOT NULL,
"title" text NOT NULL,
"summary" text,
"body" text DEFAULT '' NOT NULL,
"published" boolean DEFAULT false NOT NULL,
"sort_order" integer DEFAULT 0 NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone
);
--> statement-breakpoint
CREATE TABLE "training_resources" (
"id" text PRIMARY KEY NOT NULL,
"lesson_id" text NOT NULL,
"filename" text NOT NULL,
"mime_type" text NOT NULL,
"size_bytes" integer NOT NULL,
"stored_name" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "training_resources" ADD CONSTRAINT "training_resources_lesson_id_training_lessons_id_fk" FOREIGN KEY ("lesson_id") REFERENCES "public"."training_lessons"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "training_lessons_published_idx" ON "training_lessons" USING btree ("published");--> statement-breakpoint
CREATE INDEX "training_resources_lesson_idx" ON "training_resources" USING btree ("lesson_id");
+11
View File
@@ -0,0 +1,11 @@
CREATE TABLE "used_magic_tokens" (
"jti" text PRIMARY KEY NOT NULL,
"email" text NOT NULL,
"used_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
DROP INDEX "users_email_lower_idx";--> statement-breakpoint
ALTER TABLE "user_skills" ADD COLUMN "mentor_approved_at" timestamp with time zone;--> statement-breakpoint
ALTER TABLE "user_skills" ADD COLUMN "mentor_approved_by" text;--> statement-breakpoint
CREATE UNIQUE INDEX "users_email_lower_key" ON "users" USING btree (lower("email"));--> statement-breakpoint
ALTER TABLE "notification_rules" ADD CONSTRAINT "chk_notification_rules_channel" CHECK ("notification_rules"."channel_set" IN ('email','sms','email+sms'));
+60
View File
@@ -0,0 +1,60 @@
CREATE TABLE "event_folders" (
"id" text PRIMARY KEY NOT NULL,
"event_id" text NOT NULL,
"name" text NOT NULL,
"kind" text DEFAULT 'originals' NOT NULL,
"created_by" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "event_photographers" (
"event_id" text NOT NULL,
"user_id" text NOT NULL,
"role" text DEFAULT 'photographer' NOT NULL,
"assigned_by" text,
"assigned_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "event_photographers_pk" PRIMARY KEY("event_id","user_id")
);
--> statement-breakpoint
CREATE TABLE "event_photos" (
"id" text PRIMARY KEY NOT NULL,
"folder_id" text NOT NULL,
"uploader_id" text NOT NULL,
"filename" text NOT NULL,
"mime_type" text NOT NULL,
"size_bytes" integer NOT NULL,
"stored_name" text NOT NULL,
"checksum_sha256" text NOT NULL,
"kind" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "event_photos_stored_name_unique" UNIQUE("stored_name")
);
--> statement-breakpoint
CREATE TABLE "events" (
"id" text PRIMARY KEY NOT NULL,
"title" text NOT NULL,
"event_type" text DEFAULT 'photoshoot' NOT NULL,
"starts_at" timestamp with time zone NOT NULL,
"ends_at" timestamp with time zone,
"location" text,
"description" text,
"created_by" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone
);
--> statement-breakpoint
ALTER TABLE "event_folders" ADD CONSTRAINT "event_folders_event_id_events_id_fk" FOREIGN KEY ("event_id") REFERENCES "public"."events"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_folders" ADD CONSTRAINT "event_folders_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_photographers" ADD CONSTRAINT "event_photographers_event_id_events_id_fk" FOREIGN KEY ("event_id") REFERENCES "public"."events"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_photographers" ADD CONSTRAINT "event_photographers_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_photographers" ADD CONSTRAINT "event_photographers_assigned_by_users_id_fk" FOREIGN KEY ("assigned_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_photos" ADD CONSTRAINT "event_photos_folder_id_event_folders_id_fk" FOREIGN KEY ("folder_id") REFERENCES "public"."event_folders"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_photos" ADD CONSTRAINT "event_photos_uploader_id_users_id_fk" FOREIGN KEY ("uploader_id") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "events" ADD CONSTRAINT "events_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "event_folders_event_name_idx" ON "event_folders" USING btree ("event_id","name");--> statement-breakpoint
CREATE INDEX "event_folders_event_idx" ON "event_folders" USING btree ("event_id");--> statement-breakpoint
CREATE INDEX "event_photographers_user_idx" ON "event_photographers" USING btree ("user_id");--> statement-breakpoint
CREATE UNIQUE INDEX "event_photos_folder_checksum_idx" ON "event_photos" USING btree ("folder_id","checksum_sha256");--> statement-breakpoint
CREATE INDEX "event_photos_folder_idx" ON "event_photos" USING btree ("folder_id","created_at");--> statement-breakpoint
CREATE INDEX "events_starts_at_idx" ON "events" USING btree ("starts_at");--> statement-breakpoint
CREATE INDEX "events_created_by_idx" ON "events" USING btree ("created_by");
+12
View File
@@ -0,0 +1,12 @@
CREATE TABLE "announcements" (
"id" text PRIMARY KEY NOT NULL,
"title" text NOT NULL,
"body" text DEFAULT '' NOT NULL,
"published" boolean DEFAULT false NOT NULL,
"created_by" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone
);
--> statement-breakpoint
ALTER TABLE "announcements" ADD CONSTRAINT "announcements_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "announcements_published_created_idx" ON "announcements" USING btree ("published","created_at");
+6
View File
@@ -0,0 +1,6 @@
ALTER TABLE "event_photos" ADD COLUMN "edit_json" text;--> statement-breakpoint
ALTER TABLE "event_photos" ADD COLUMN "edited_stored_name" text;--> statement-breakpoint
ALTER TABLE "event_photos" ADD COLUMN "edited_size_bytes" integer;--> statement-breakpoint
ALTER TABLE "event_photos" ADD COLUMN "edited_at" timestamp with time zone;--> statement-breakpoint
ALTER TABLE "event_photos" ADD COLUMN "edited_by" text;--> statement-breakpoint
ALTER TABLE "event_photos" ADD CONSTRAINT "event_photos_edited_by_users_id_fk" FOREIGN KEY ("edited_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;
+5
View File
@@ -0,0 +1,5 @@
ALTER TABLE "users" ADD COLUMN "username" text;--> statement-breakpoint
UPDATE "users" SET "username" = lower("email") WHERE "username" IS NULL;--> statement-breakpoint
ALTER TABLE "users" ALTER COLUMN "username" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "password_hash" text;--> statement-breakpoint
CREATE UNIQUE INDEX "users_username_lower_key" ON "users" USING btree (lower("username"));
+33
View File
@@ -0,0 +1,33 @@
CREATE TABLE "event_videos" (
"id" text PRIMARY KEY NOT NULL,
"event_id" text NOT NULL,
"uploader_id" text NOT NULL,
"title" text NOT NULL,
"description" text,
"filename" text NOT NULL,
"mime_type" text NOT NULL,
"size_bytes" integer NOT NULL,
"checksum_sha256" text NOT NULL,
"original_stored_name" text NOT NULL,
"archive_folder" text NOT NULL,
"duration_ms" integer,
"width" integer,
"height" integer,
"trim_start_ms" integer DEFAULT 0 NOT NULL,
"trim_end_ms" integer,
"web_stored_name" text,
"poster_stored_name" text,
"status" text DEFAULT 'processing' NOT NULL,
"visibility" text DEFAULT 'team' NOT NULL,
"error_message" text,
"processed_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "event_videos_original_stored_name_unique" UNIQUE("original_stored_name")
);
--> statement-breakpoint
ALTER TABLE "event_videos" ADD CONSTRAINT "event_videos_event_id_events_id_fk" FOREIGN KEY ("event_id") REFERENCES "public"."events"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_videos" ADD CONSTRAINT "event_videos_uploader_id_users_id_fk" FOREIGN KEY ("uploader_id") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "event_videos_event_checksum_idx" ON "event_videos" USING btree ("event_id","checksum_sha256");--> statement-breakpoint
CREATE INDEX "event_videos_event_created_idx" ON "event_videos" USING btree ("event_id","created_at");--> statement-breakpoint
CREATE INDEX "event_videos_status_idx" ON "event_videos" USING btree ("status");
+1
View File
@@ -0,0 +1 @@
ALTER TABLE "event_videos" ALTER COLUMN "size_bytes" SET DATA TYPE bigint;
+2
View File
@@ -0,0 +1,2 @@
ALTER TABLE "users" ADD COLUMN "calendar_feed_token" text;--> statement-breakpoint
CREATE UNIQUE INDEX "users_calendar_feed_token_key" ON "users" USING btree ("calendar_feed_token");
+81
View File
@@ -0,0 +1,81 @@
CREATE TABLE "coverage_intakes" (
"id" text PRIMARY KEY NOT NULL,
"requester_name" text NOT NULL,
"requester_email" text NOT NULL,
"requester_phone" text,
"ministry" text,
"title" text NOT NULL,
"event_type" text DEFAULT 'coverage' NOT NULL,
"starts_at" timestamp with time zone NOT NULL,
"ends_at" timestamp with time zone,
"location" text,
"description" text,
"status" text DEFAULT 'new' NOT NULL,
"created_event_id" text,
"reviewed_by" text,
"reviewed_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "coverage_requests" (
"id" text PRIMARY KEY NOT NULL,
"assignment_id" text NOT NULL,
"requested_by" text NOT NULL,
"reason" text,
"status" text DEFAULT 'pending' NOT NULL,
"replacement_user_id" text,
"resolved_by" text,
"resolved_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "run_sheet_items" (
"id" text PRIMARY KEY NOT NULL,
"service_instance_id" text NOT NULL,
"sort_order" integer DEFAULT 0 NOT NULL,
"time_label" text,
"title" text NOT NULL,
"owner" text,
"notes" text
);
--> statement-breakpoint
CREATE TABLE "service_checklist_items" (
"id" text PRIMARY KEY NOT NULL,
"service_instance_id" text NOT NULL,
"phase" text DEFAULT 'pre' NOT NULL,
"sort_order" integer DEFAULT 0 NOT NULL,
"label" text NOT NULL,
"done_at" timestamp with time zone,
"done_by" text
);
--> statement-breakpoint
CREATE TABLE "service_run_sheets" (
"service_instance_id" text PRIMARY KEY NOT NULL,
"speaker" text,
"sermon_title" text,
"stream_url" text,
"slides_url" text,
"notes" text,
"updated_by" text,
"updated_at" timestamp with time zone
);
--> statement-breakpoint
ALTER TABLE "coverage_intakes" ADD CONSTRAINT "coverage_intakes_created_event_id_events_id_fk" FOREIGN KEY ("created_event_id") REFERENCES "public"."events"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "coverage_intakes" ADD CONSTRAINT "coverage_intakes_reviewed_by_users_id_fk" FOREIGN KEY ("reviewed_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "coverage_requests" ADD CONSTRAINT "coverage_requests_assignment_id_assignments_id_fk" FOREIGN KEY ("assignment_id") REFERENCES "public"."assignments"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "coverage_requests" ADD CONSTRAINT "coverage_requests_requested_by_users_id_fk" FOREIGN KEY ("requested_by") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "coverage_requests" ADD CONSTRAINT "coverage_requests_replacement_user_id_users_id_fk" FOREIGN KEY ("replacement_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "coverage_requests" ADD CONSTRAINT "coverage_requests_resolved_by_users_id_fk" FOREIGN KEY ("resolved_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "run_sheet_items" ADD CONSTRAINT "run_sheet_items_service_instance_id_service_instances_id_fk" FOREIGN KEY ("service_instance_id") REFERENCES "public"."service_instances"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "service_checklist_items" ADD CONSTRAINT "service_checklist_items_service_instance_id_service_instances_id_fk" FOREIGN KEY ("service_instance_id") REFERENCES "public"."service_instances"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "service_checklist_items" ADD CONSTRAINT "service_checklist_items_done_by_users_id_fk" FOREIGN KEY ("done_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "service_run_sheets" ADD CONSTRAINT "service_run_sheets_service_instance_id_service_instances_id_fk" FOREIGN KEY ("service_instance_id") REFERENCES "public"."service_instances"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "service_run_sheets" ADD CONSTRAINT "service_run_sheets_updated_by_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "coverage_intakes_status_idx" ON "coverage_intakes" USING btree ("status","created_at");--> statement-breakpoint
CREATE INDEX "coverage_intakes_starts_idx" ON "coverage_intakes" USING btree ("starts_at");--> statement-breakpoint
CREATE UNIQUE INDEX "coverage_requests_pending_assignment_idx" ON "coverage_requests" USING btree ("assignment_id") WHERE "coverage_requests"."status" = 'pending';--> statement-breakpoint
CREATE INDEX "coverage_requests_status_idx" ON "coverage_requests" USING btree ("status","created_at");--> statement-breakpoint
CREATE INDEX "coverage_requests_requester_idx" ON "coverage_requests" USING btree ("requested_by");--> statement-breakpoint
CREATE INDEX "run_sheet_items_instance_idx" ON "run_sheet_items" USING btree ("service_instance_id","sort_order");--> statement-breakpoint
CREATE UNIQUE INDEX "service_checklist_instance_label_idx" ON "service_checklist_items" USING btree ("service_instance_id","phase","label");--> statement-breakpoint
CREATE INDEX "service_checklist_instance_idx" ON "service_checklist_items" USING btree ("service_instance_id","phase","sort_order");
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+84
View File
@@ -71,6 +71,90 @@
"when": 1795026324840,
"tag": "0009_last_wallop",
"breakpoints": true
},
{
"idx": 10,
"version": "7",
"when": 1795046258819,
"tag": "0010_friendly_oracle",
"breakpoints": true
},
{
"idx": 11,
"version": "7",
"when": 1795046710473,
"tag": "0011_pretty_lilith",
"breakpoints": true
},
{
"idx": 12,
"version": "7",
"when": 1795049817583,
"tag": "0012_admin_content",
"breakpoints": true
},
{
"idx": 13,
"version": "7",
"when": 1795064690721,
"tag": "0013_fearless_gravity",
"breakpoints": true
},
{
"idx": 14,
"version": "7",
"when": 1795066490416,
"tag": "0014_nifty_calypso",
"breakpoints": true
},
{
"idx": 15,
"version": "7",
"when": 1795067725803,
"tag": "0015_vengeful_sabra",
"breakpoints": true
},
{
"idx": 16,
"version": "7",
"when": 1795089803751,
"tag": "0016_orange_synch",
"breakpoints": true
},
{
"idx": 17,
"version": "7",
"when": 1795102546645,
"tag": "0017_dear_mandarin",
"breakpoints": true
},
{
"idx": 18,
"version": "7",
"when": 1795107065145,
"tag": "0018_brave_rick_jones",
"breakpoints": true
},
{
"idx": 19,
"version": "7",
"when": 1795114809159,
"tag": "0019_raise_event_video_limit",
"breakpoints": true
},
{
"idx": 20,
"version": "7",
"when": 1795138529856,
"tag": "0020_square_wolfpack",
"breakpoints": true
},
{
"idx": 21,
"version": "7",
"when": 1795141771191,
"tag": "0021_sparkling_exiles",
"breakpoints": true
}
]
}