twenty
twenty copied to clipboard
Refactor migration runner within transaction
Modifying the data-model can sometimes fail in the middle of your operation, due to the way we handle both metadata update and schema migration separately, a field can be created while the associated column creation failed (same for object/table and such). This is also an issue because WorkspaceMigrations are then stored as FAILED can never really recovered by themselves so the schema is broken and we can't update the models anymore. This PR adds a executeMigrationFromPendingMigrationsWithinTransaction method where we can (and must) pass a queryRunner executing a transaction, which should come from the metadata services so that if anything during metadata update OR schema update fails, it rolls back everything (this also mean a workspaceMigration should never stay in a failed state now). This also fixes some issues with migration not running in the correct order due to having the same timestamp and having to do some weird logic to fix that.
This is a first step and fix before working on a much more reliable solution in the upcoming weeks where we will refactor the way we interact with the data model.
🚀 Preview Environment Ready!
Your preview environment is available at: http://bore.pub:28201
This environment will automatically shut down when the PR is closed or after 5 hours.
(this also mean a workspaceMigration should never stay in a failed state now).
This means it will stay as no applied yet ?
(this also mean a workspaceMigration should never stay in a failed state now).
This means it will stay as no applied yet ?
it won't even be stored in the DB
Suspect Issues
This pull request was deployed and Sentry observed the following issues:
-
‼️ TypeORMError: Column "contactType" was not found i... in
prod -
‼️ TypeORMError: Table "workspace_10l193xrbb1vjkmp79b... in
prod -
‼️ QueryFailedError: column "clientId" of relation "_... in
prod -
‼️ TypeORMError: Column "jobPostId" was not found in... in
prod
Did you find this useful? React with a 👍 or 👎
Suspect Issues
This pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎
Impossible this hasn't been released in production yet, this will fix the issue