diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-09-27 11:45:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-27 11:45:11 -0400 |
commit | cb6ea5148bffdc6266740e2e7bf30965f3060680 (patch) | |
tree | 0888353d1ebce507db0aa066dba47f4fa5f5c1ec /activerecord/test/cases/invertible_migration_test.rb | |
parent | 8a0194f1514fc2374b18db909f78f733ba0857b9 (diff) | |
parent | bdd8d5898710e727c55b514804a221b6eddbda41 (diff) | |
download | rails-cb6ea5148bffdc6266740e2e7bf30965f3060680.tar.gz rails-cb6ea5148bffdc6266740e2e7bf30965f3060680.tar.bz2 rails-cb6ea5148bffdc6266740e2e7bf30965f3060680.zip |
Merge pull request #31604 from fatkodima/reverting-transaction
Fix `transaction` reverting for migrations
Diffstat (limited to 'activerecord/test/cases/invertible_migration_test.rb')
-rw-r--r-- | activerecord/test/cases/invertible_migration_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/invertible_migration_test.rb b/activerecord/test/cases/invertible_migration_test.rb index 363beb4780..6cf17ac15d 100644 --- a/activerecord/test/cases/invertible_migration_test.rb +++ b/activerecord/test/cases/invertible_migration_test.rb @@ -22,6 +22,14 @@ module ActiveRecord end end + class InvertibleTransactionMigration < InvertibleMigration + def change + transaction do + super + end + end + end + class InvertibleRevertMigration < SilentMigration def change revert do @@ -271,6 +279,14 @@ module ActiveRecord assert_not revert.connection.table_exists?("horses") end + def test_migrate_revert_transaction + migration = InvertibleTransactionMigration.new + migration.migrate :up + assert migration.connection.table_exists?("horses") + migration.migrate :down + assert_not migration.connection.table_exists?("horses") + end + def test_migrate_revert_change_column_default migration1 = ChangeColumnDefault1.new migration1.migrate(:up) |