When would you want to use disable_ddl_transaction in Rails?

All migrations are wrapped in transaction by default so that they can be rolled back when they are failed.

You need to use disable_ddl_transaction when you want to do something that can not excute inside a transaction. You can check Transactional Migrations section of Migration document for example.

Leave a Comment