-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
post-mortem: migration pipeline (apr 5 2026)
what broke
db:migrate hung indefinitely after merging
migration hang
better-sqlite3 v12.8.0 silently changed its default behavior: new connections now have foreign_keys=on. drizzle-orm's migrate runner wraps all migration sql in an explicit begin transaction before executing it. sqlite's documented behavior is that pragma foreign_keys is silently ignored inside a transaction. so the pragma foreign_keys=off in drizzle's generated table-recreation sql had no effect, and drop a table hung indefinitely waiting for an exclusive lock it could never get — 13 other tables had foreign key references pointing at the effected table
the fix: db/migrate.~ath sets foreign_keys=off before calling migrate(), outside any transaction, where the pragma actually takes effect. foreign_keys=on is restored after.
production deploy failure
root causes
better-sqlite3 breaking change buried in a minor version bump (12.7 → 12.8)
drizzle-orm's transaction wrapping making pragma statements inside migration sql unreliable by design
#siteupdates #postmortum
-----BEGIN PGP SIGNATURE-----
axpsk/DYKuOMsxfgbIdxTLVzJkDsNDvCrvegHCVJbTVnWOqZSkSyBnPJrIFJkPYA
+oS+tzOgVgwyAVtIbKWBIocWfVWcscveHyx+WuYl+kXZY/uL+lgPDpjsWjKVKeER
ftCLhbyuPp/jqvcAdDdDMYIemGCxxB+VlQDKWBqEqRRCnYG+HlnEqfJMBraUwRAe
LEzaWZMqvkv/jyLpjsHSkfyKkepJ+/SHlOYRPvOCBeNPCignXDORMGMfbSCEYmsw
AmywMByUDC/sydVAPI+bBhTZsqrrFPXxhNyzqfVY+UazrrhoNXpVnBvcxpVKDtRE
zFVLD/UUdKdYWQnrYTzxEDYDVhZal+nWfgzhpRPxLbXDCeSTdT+GoH/BqCUxepCR
+BeW
=MRzA
-----END PGP SIGNATURE-----
Kult: +30
Total: 30
