-
-
Notifications
You must be signed in to change notification settings - Fork 162
Description
I am facing an issue while using umzug.up() in my project.
Suppose I have 10 migration files. While executing the last migration, a query fails, which correctly causes the transaction to roll back. However, despite the rollback, the name of the migration file still gets stored in the database.
As a result, when I attempt to run the migration again, Umzug considers it already applied. I have to manually remove the migration record from the database to rerun it, which is not ideal.
After debugging, I found that the following function inside the Umzug storage implementation does not use the transaction I passed:
async logMigration({ name: migrationName }) { await this.syncModel(); await this.model.create({ [this.columnName]: migrationName, }); }
Since this function doesn't respect the transaction, the migration record is committed even if the actual migration fails and rolls back.