* fix(db): reconcile orphaned mail-hunt migrations applied to prod Prod carries 20260807090000_mail_connections and 20260807090100_inbox_mail_hunt_source (applied 2026-08-07 morning) with no files in supabase/migrations/, so the Supabase integration fails every push to main with "Remote migration versions not found in local migrations directory". This commits the byte-identical SQL recovered from prod's supabase_migrations.schema_migrations statements under the exact applied versions. No new DDL runs on prod: the versions already exist there, this only reconciles the repo. Also classifies mail_connections in full-archive-export.ts (excluded: live OAuth refresh tokens, not portable), which the archive-completeness test requires for any new company_id table. Whoever owns the mail-hunt feature branch: these files now exist on main; reuse them as-is instead of re-creating the versions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(db): annotate reconciled mail_connections migration as pg-test skip The file is a byte-recovered reconciliation of DDL already applied to prod; it never executes again, so pg-real coverage belongs to the mail-hunt feature branch that owns the schema. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
29 lines
1.0 KiB
SQL
29 lines
1.0 KiB
SQL
ALTER TABLE public.invoice_inbox_items
|
|
DROP CONSTRAINT IF EXISTS invoice_inbox_items_source_check;
|
|
|
|
ALTER TABLE public.invoice_inbox_items
|
|
ADD CONSTRAINT invoice_inbox_items_source_check
|
|
CHECK (source IN ('email', 'upload', 'whatsapp', 'mail_hunt')) NOT VALID;
|
|
|
|
ALTER TABLE public.invoice_inbox_items
|
|
VALIDATE CONSTRAINT invoice_inbox_items_source_check;
|
|
|
|
ALTER TABLE public.document_attachments
|
|
DROP CONSTRAINT IF EXISTS document_attachments_upload_source_check;
|
|
|
|
ALTER TABLE public.document_attachments
|
|
ADD CONSTRAINT document_attachments_upload_source_check
|
|
CHECK (upload_source IN (
|
|
'camera', 'file_upload', 'email', 'e_invoice', 'scan', 'api', 'system',
|
|
'whatsapp', 'mail_hunt'
|
|
)) NOT VALID;
|
|
|
|
ALTER TABLE public.document_attachments
|
|
VALIDATE CONSTRAINT document_attachments_upload_source_check;
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_invoice_inbox_mail_message_unique
|
|
ON public.invoice_inbox_items (company_id, ((channel_context->>'mail_message_id')))
|
|
WHERE source = 'mail_hunt';
|
|
|
|
NOTIFY pgrst, 'reload schema';
|