Skip to content

Transactional migrations are applied partially if fail in the middle #217

@vimmerru

Description

@vimmerru

Describe the bug
I have the following mikro-orm.config.ts

export default {
    ...config,
    entities: Object.values(entities),
    migrations: {
        tableName: 'migrations', // name of database table with log of executed transactions
        path: './migrations', // path to the folder with migrations
        transactional: true, // wrap each migration in a transaction
        disableForeignKeys: true, // wrap statements with `set foreign_key_checks = 0` or equivalent
        allOrNothing: true, // wrap all migrations in master transaction
    },
};

I don't override isTransactional in migration classes

I noticed on debugging migrations that if i have an error in some statement in the middle of migration previous statements are still applied to the database. All It indicates that there is no migration transaction and master transaction too.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions