Problem
Migrations copy legacy date columns straight into NOT NULL createdAt/updatedAt under STRICT sql_mode. A single 0000-00-00/NULL legacy row aborts the whole transactional batch — risking the live 480-URL / 5-org / 7-user migration.
Affected
web/_sql/migrations/001_migrate_organisations.sql, 002_migrate_users.sql, 003_migrate_categories.sql, 004_migrate_shorturls.sql
Fix
Guard every legacy date, e.g. IFNULL(NULLIF(old.dateCol,'0000-00-00 00:00:00'), NOW()); or pre-clean source dates. Add a migrated-vs-source row-count assertion after COMMIT.
Acceptance criteria
From the 2026-06-04 schema review — see docs/SCHEMA_REVIEW_2026-06-04.md.
Problem
Migrations copy legacy date columns straight into
NOT NULL createdAt/updatedAtunder STRICTsql_mode. A single0000-00-00/NULL legacy row aborts the whole transactional batch — risking the live 480-URL / 5-org / 7-user migration.Affected
web/_sql/migrations/001_migrate_organisations.sql,002_migrate_users.sql,003_migrate_categories.sql,004_migrate_shorturls.sqlFix
Guard every legacy date, e.g.
IFNULL(NULLIF(old.dateCol,'0000-00-00 00:00:00'), NOW()); or pre-clean source dates. Add a migrated-vs-source row-count assertion after COMMIT.Acceptance criteria
From the 2026-06-04 schema review — see
docs/SCHEMA_REVIEW_2026-06-04.md.