Skip to content

Transaction issue while using umzug.up() #708

Description

@abhishekS-mygstcafe

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions