rails/rails — pull request #6768 by bogdan (2012-06-18 07:51:27+00:00)
Title: AR::Migration#migrate: apply all migration under same DDL transaction

Example: let's say that we need to apply two migration on production. First one delete unused column A. Second one does complicated data migration that failed during migration. In this case source code will be rollback to previous working version, but only the last migration got reverted. Production will run previous working version of source code that expects column A to exists, but it is not.

The thing that ActiveRecord::Migrator rollbacks only last applied migration will create inconsistency between data and code. It could be sensitive in some cases in production mode.

This patch applies all migrations under same ddl transaction if it is supported by database, so that Database state and source code are always consistent.