Refine workspaces and event publishing; harden uploads and email delivery
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "events" ADD COLUMN "location" text;
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "events" ADD COLUMN "banner_photo_id" uuid;
|
||||
@@ -0,0 +1,8 @@
|
||||
ALTER TABLE "events" ADD COLUMN "latitude" double precision;
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "events" ADD COLUMN "longitude" double precision;
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "events" ADD CONSTRAINT "events_coordinates_check" CHECK (
|
||||
("latitude" IS NULL AND "longitude" IS NULL) OR
|
||||
("latitude" IS NOT NULL AND "longitude" IS NOT NULL AND "latitude" BETWEEN -90 AND 90 AND "longitude" BETWEEN -180 AND 180)
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
ALTER TABLE "events" ADD COLUMN "custom_banner_id" uuid;
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "event_banners" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
"event_id" uuid NOT NULL REFERENCES "events"("id") ON DELETE CASCADE,
|
||||
"original_key" text NOT NULL,
|
||||
"display_key" text,
|
||||
"content_type" text NOT NULL,
|
||||
"byte_size" integer NOT NULL,
|
||||
"status" text NOT NULL DEFAULT 'uploading',
|
||||
"created_at" timestamptz NOT NULL DEFAULT now(),
|
||||
"updated_at" timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "event_banners_event_idx" ON "event_banners" ("event_id");
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "event_banners_status_idx" ON "event_banners" ("status");
|
||||
@@ -0,0 +1,6 @@
|
||||
ALTER TABLE events ADD COLUMN notes_policy text NOT NULL DEFAULT 'never' CHECK (notes_policy IN ('automatic', 'approved', 'never'));
|
||||
ALTER TABLE events ADD COLUMN gallery_policy text NOT NULL DEFAULT 'approved' CHECK (gallery_policy IN ('automatic', 'approved', 'never'));
|
||||
ALTER TABLE events ADD COLUMN show_photo_stats boolean NOT NULL DEFAULT false;
|
||||
ALTER TABLE events ADD COLUMN show_submitter_stats boolean NOT NULL DEFAULT false;
|
||||
ALTER TABLE events ADD COLUMN show_note_stats boolean NOT NULL DEFAULT false;
|
||||
ALTER TABLE guests ADD COLUMN note_approved boolean NOT NULL DEFAULT false;
|
||||
@@ -0,0 +1,7 @@
|
||||
ALTER TABLE events ADD COLUMN publish_at timestamptz;
|
||||
ALTER TABLE events ADD COLUMN submissions_open_at timestamptz;
|
||||
ALTER TABLE events ADD COLUMN submissions_close_at timestamptz;
|
||||
ALTER TABLE events ADD COLUMN gallery_visible_at timestamptz;
|
||||
ALTER TABLE events ADD COLUMN notes_visible_at timestamptz;
|
||||
ALTER TABLE events ADD COLUMN completed_at timestamptz;
|
||||
ALTER TABLE guests ADD COLUMN notification_claimed_at timestamptz;
|
||||
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE email_deliveries (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), event_id uuid NOT NULL REFERENCES events(id) ON DELETE CASCADE,
|
||||
recipient text NOT NULL, payload jsonb NOT NULL, provider text NOT NULL,
|
||||
status text NOT NULL DEFAULT 'pending', attempts integer NOT NULL DEFAULT 0,
|
||||
first_attempt_at timestamptz, next_attempt_at timestamptz NOT NULL DEFAULT now(),
|
||||
provider_id text, last_error text, created_at timestamptz NOT NULL DEFAULT now(), updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE UNIQUE INDEX email_deliveries_event_recipient_idx ON email_deliveries(event_id, recipient);
|
||||
CREATE INDEX email_deliveries_queue_idx ON email_deliveries(status, next_attempt_at);
|
||||
@@ -0,0 +1,8 @@
|
||||
CREATE TABLE "email_webhook_events" (
|
||||
"id" text PRIMARY KEY,
|
||||
"provider_id" text NOT NULL,
|
||||
"outcome" text NOT NULL,
|
||||
"occurred_at" timestamp with time zone NOT NULL,
|
||||
"received_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
CREATE INDEX "email_webhook_events_provider_idx" ON "email_webhook_events" ("provider_id");
|
||||
@@ -15,6 +15,55 @@
|
||||
"when": 1788819000000,
|
||||
"tag": "0001_groups_roles_guests",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "7",
|
||||
"when": 1788905400000,
|
||||
"tag": "0002_event_information",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "7",
|
||||
"when": 1788905500000,
|
||||
"tag": "0003_event_coordinates",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 4,
|
||||
"version": "7",
|
||||
"when": 1788905600000,
|
||||
"tag": "0004_event_banner_uploads",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 5,
|
||||
"version": "7",
|
||||
"when": 1788905700000,
|
||||
"tag": "0005_publishing_preferences",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 6,
|
||||
"version": "7",
|
||||
"when": 1788905800000,
|
||||
"tag": "0006_event_lifecycle",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 7,
|
||||
"version": "7",
|
||||
"when": 1788905900000,
|
||||
"tag": "0007_email_outbox",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 8,
|
||||
"version": "7",
|
||||
"when": 1788906000000,
|
||||
"tag": "0008_email_webhooks",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user