Today I Learned

hashrocket 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.

See More #rails TILs
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.