Today I Learned

A Hashrocket project

Disable Rails migration Transaction wrapper

Rails Migrations are wrapped by a database transaction by default, so if you need to disable it by any reason use disable_ddl_transaction!().

class MyMigration < ActiveRecord::Migration[5.1]
  disable_ddl_transaction!

  def change
    # run some code with no db transaction
  end
end

Check the documentation.

Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket and we'd love to take a look at your project. Contact us and find out how we can help you.