mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
A concurrent build that is still running is INVALID with its migration not yet finished, exactly like a failed one. With the web and worker roles in two containers, the second boot dropped the index the first was building, which cancelled the first one's migration and left it failed until someone resolved it by hand. The check and the drop now run in one transaction that first takes Prisma's migration lock without waiting and does nothing when another instance holds it; an index Postgres reports as being built is never dropped. One transaction also keeps lock_timeout on the statement it bounds behind a transaction pooler, and the applied-migrations lookup quotes the schema, so a mixed-case schema no longer reads as having none applied.