Nishant Salhotra
06/02/2021, 11:21 AMBEGIN...COMMIT). What will happen if one of the queries within that transaction fail?
2. What will happen to the queries executed before a failure during the migration. From what I've observed, the queries executed before the failed query aren't rolled back. But just wanted to check what would be the best practices around making sure that each migration is a transaction?
3. When is applied_steps_count incremented in _prisma_migrations table?tom
06/02/2021, 11:37 AMBEGIN and COMMIT statements yourself where you want them. Migrate works that way to be less surprising, and at scale, transactions can be impractical.
If you have a transaction block in the middle of a migration, and one statement fails, then: a. the whole migration will stop there, b. the previous statements inside the transaction block will be rolled back, but not the statements before the BEGIN.tom
06/02/2021, 11:38 AMtom
06/02/2021, 11:40 AMBEGIN at the start of each migration and a COMMIT at the end will give you real transactions. We might want to add optional automatic transactions in the future, but I haven't seen many people asking for it, so if you are interested, a GitHub issue stating your use case would be the next step.tom
06/02/2021, 11:41 AMtom
06/02/2021, 11:41 AMNishant Salhotra
06/02/2021, 11:52 AM