You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every migration is wrapped in tx by default, but does it possible to wrap bunch of them? I had no success while implementing it by myself, because goose.Up accepts *sql.DB.
The text was updated successfully, but these errors were encountered:
It's not supported today, but it's something I'd like to add support for. Related #222
I'd like to call this "grouped migrations", where goose applies a group of separate migration files in a single transaction.
However, what should the behaviour be when one of those migration files cannot be executed within a transaction?
For example, say we have 6 new migrations: 11, 12, 13, 14, 15, 16 and migration 14 is marked with NO TRANSACTION. We cannot apply all 6 migrations in the same *sql.Tx.
The best we can do in this scenario (I think) is apply 11, 12, 13 in the same *sql.Tx and commit, then apply 14 with *sql.DB (or *sql.Conn) and then apply 15, 16 in another *sql.Tx and commit. It's a bit of an edge case, but it's something we have to account for.
Alternatively, we could do a look ahead and detect that you've opted in to "grouped migrations" and have a migration that cannot be applied in a transaction. I don't like this option though because it requires the user to modify goose.
Every migration is wrapped in tx by default, but does it possible to wrap bunch of them? I had no success while implementing it by myself, because
goose.Up
accepts*sql.DB
.The text was updated successfully, but these errors were encountered: