Migrations wrapped in the db transaction?
I am using branching and db migrations and I wonder if the migration file is automatically wrapped in a db transaction so that nothing from the file is applied if something fails? I don't see this documented anywhere.
9 Replies
That is what I expected too but I just had a case where migration has failed but it was partially applied. So it must be some bug
Maybe give some info on what was partially applied. If true (migration file in transaction) it would be a postgres thing and not likely bugged.
I have a migration file that looks something like this:
and the dashboard says that the migration failed with this error:
but I see cashu_proofs table created. Also in schema_migrations table I see that migration as executed.
Full migration file can be seen here. It's pretty long so in the message above I left only what should be important for the issue.


If @vick comes around maybe he can throw in some ideas.
But other than him, you likely won't get help in the detail level here assuming no one else has input on transaction being involved with the migration file. Another mod thinks so too... https://discord.com/channels/839993398554656828/1429254115464052907/1429259581069983764
But other than him, you likely won't get help in the detail level here assuming no one else has input on transaction being involved with the migration file. Another mod thinks so too... https://discord.com/channels/839993398554656828/1429254115464052907/1429259581069983764
I mean migration was supposed to fail because there was some existing data that didn't respect the constraint but I expected it to be rolled back
ok. I will report the bug then. thx for the help
I know for the CLI migrations run in transactions, but I don't use branching so not sure how those work.