Run Migrations Outside of a Transaction
Explore how to run Ecto migrations outside of database transactions to enable concurrent index changes. Understand when to disable migration locks and apply changes carefully to maintain database integrity during large or complex updates.
Disable transactional behavior
By default, migrations are run within a database transaction. This is a good thing. If any part of our migration has an error, we can be assured that the database will be restored back to the way it was. There may be times when we won’t want to do it this way, though. In those cases, we can disable the transactional behavior by setting the module attribute @disable_ddl_transaction to true, like so.