Run Migration not in a transaction
davidmdm opened this issue · comments
I can see in package migrate that there is an option to DisableTx
,
However I can't figure out how to disable them when simply calling the tern command line.
If I have 5 migration files, and 1 of them should not be run inside of a transaction, how do I do this?
That setting isn't wired into the CLI. No reason not to, just no one ever did it.
Would there be a filename convention to disable running the Migration in a transaction that would be suitable for you?
If so than I might make a PR for it.
something like:
002_create_table_foo.no_tx.sql
?
Other tools generally enable transactions with the .tx.sql
suffix instead of disabling them, but doing that would break backwards compatability.
Is this a feature you would like to have?
The overall feature is fine, but I would probably lean toward a magic comment rather than something as part of the file name. That would allow conveniently adding more per migration behavior flags.
It's not just the CLI, it's a bit clunky to use in code too. This struct is not exported:
Line 107 in 0c8ea39
So if I want to set DisableTx
in the MigratorOptions
passed to NewMigratorEx
, I have to reimplement the default file system migrator. Regardless of #43 it could be good to expose this struct for the future (unless MigratorFS
will always be the only option).
This should be resolved on v2-dev
with b23e02f.