What does safe and dropTable in migrations config actually means? #5401
-
So, I'm trying to make safe migrations, meaning no columns drop, and no table drops shall be generated. In the configs there are safe and dropTable configs for that. https://mikro-orm.io/docs/migrations#configuration But the way fields are described I don't understand what does those parameters actually do. I'd assume that dropTables: false, and safe: true should do the trick, but I seemed to be not getting this behaviour. So, the question, how can I achieve such "safe" behaviour from migrator I described? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I don't think it behaves this way. If you enable safe mode, it implies If it doesn't work for you this way, repro welcome. |
Beta Was this translation helpful? Give feedback.
I don't think it behaves this way.
dropTables
controls whether anydrop 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 blocksdrop column
queries and maybe something else, not 100% sure now).If it doesn't work for you this way, repro welcome.