0012_email_suppressions.sql20 lines · main
| 1 | -- email_suppressions — recipients we won't send to. |
| 2 | -- Populated by the mittera webhook (permanent bounces, complaints, |
| 3 | -- mittera-side suppressions) and by operator action via the admin UI. |
| 4 | -- The outbound send path checks this table before posting to mittera. |
| 5 | |
| 6 | CREATE TABLE IF NOT EXISTS "email_suppressions" ( |
| 7 | "id" text PRIMARY KEY NOT NULL, |
| 8 | "email" text NOT NULL, |
| 9 | "reason" text NOT NULL, |
| 10 | "detail" text, |
| 11 | "source_event_id" text, |
| 12 | "created_at" timestamp with time zone DEFAULT now() NOT NULL, |
| 13 | CONSTRAINT "email_suppressions_email_unique" UNIQUE ("email") |
| 14 | ); |
| 15 | |
| 16 | CREATE INDEX IF NOT EXISTS "email_suppressions_email_idx" |
| 17 | ON "email_suppressions" USING btree ("email"); |
| 18 | |
| 19 | CREATE INDEX IF NOT EXISTS "email_suppressions_created_idx" |
| 20 | ON "email_suppressions" USING btree ("created_at"); |