Skip to content

What does safe and dropTable in migrations config actually means? #5401

Answered by B4nan
artsiommiksiuk asked this question in Q&A
Discussion options

You must be logged in to vote

If dropTables: false - migrator still generated drop table statements, if set true it doesn't
With safe: true / false - I didn't seem to get different result.

I don't think it behaves this way. dropTables controls whether any drop table queries are issued by the schema generator:

https://github.com/mikro-orm/mikro-orm/blob/master/packages/knex/src/schema/SqlSchemaGenerator.ts#L281

If you enable safe mode, it implies dropTables = false (and also blocks drop column queries and maybe something else, not 100% sure now).

If it doesn't work for you this way, repro welcome.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@artsiommiksiuk
Comment options

Answer selected by artsiommiksiuk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants