diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 34f20ba..49a7bc3 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -284,6 +284,11 @@ const IMPORTERS: ImporterConfig[] = [ // in batched upserts where Postgrest sends the column union. r.status = "intake"; } + // Default opened_at to today when missing — avoids NULL violations + // in batched upserts where Postgrest sends the column union. + if (!r.opened_at) { + r.opened_at = new Date().toISOString().slice(0, 10); + } // Normalise billing method if (r.billing_method) { const bm = String(r.billing_method).toLowerCase();