hasura / hasura/graphql-engine
Aborting `migrate apply` leaves the database in an inconsistent state
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
We currently run our PR builds on Heroku using the cli-migrations-v3 image. In situations where applying migrations takes longer than 60 seconds, Heroku will kill the process with a boot timeout because it has not yet started listening on `$PORT`.
Our v1.3 workaround was to automatically restart the app if it crashed with a boot timeout and let it apply the rest of the migrations.
Since upgrading to v2.0, this often leaves the database in an inconsistent state because running the migration and updating the version are not done in a transactional manner (`Run` succeeds, but `SetVersion` does not get called). This requires manual intervention to mark the last migration as successful with `--version=VERSION --skip-execution`.
https://github.com/hasura/graphql-engine/blob/5b7d949ef41c37104d4650ccbd1445e678bfbf0e/cli/migrate/migrate.go#L1167-L1177
Contributor guide
Assessment
This issue has not been assessed yet.