diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-06 12:23:56 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-06 12:23:56 -0700 |
commit | 4be5bce125a19a5bc0a60b33e08fdaf2066fa4d9 (patch) | |
tree | e9d684ba94974f8ebb2780c51d1b8178575e9dc4 /activerecord/test | |
parent | 32b4abddfa1f01009e0a9eb2a8820715b2fae78a (diff) | |
parent | 3771e4d51122e1ec22728029bae00f121d5d4e3b (diff) | |
download | rails-4be5bce125a19a5bc0a60b33e08fdaf2066fa4d9.tar.gz rails-4be5bce125a19a5bc0a60b33e08fdaf2066fa4d9.tar.bz2 rails-4be5bce125a19a5bc0a60b33e08fdaf2066fa4d9.zip |
Merge pull request #10437 from neerajdotname/10419
raise IrreversibleMigration if no column given
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/invertible_migration_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/activerecord/test/cases/invertible_migration_test.rb b/activerecord/test/cases/invertible_migration_test.rb index be59ffc4ab..0631871bd5 100644 --- a/activerecord/test/cases/invertible_migration_test.rb +++ b/activerecord/test/cases/invertible_migration_test.rb @@ -58,6 +58,24 @@ module ActiveRecord end end + class RemoveIndexMigration1 < SilentMigration + def self.up + create_table("horses") do |t| + t.column :name, :text + t.column :color, :text + t.index [:name, :color] + end + end + end + + class RemoveIndexMigration2 < SilentMigration + def change + change_table("horses") do |t| + t.remove_index [:name, :color] + end + end + end + class LegacyMigration < ActiveRecord::Migration def self.up create_table("horses") do |t| @@ -104,6 +122,16 @@ module ActiveRecord end end + def test_exception_on_removing_index_without_column_option + RemoveIndexMigration1.new.migrate(:up) + migration = RemoveIndexMigration2.new + migration.migrate(:up) + + assert_raises(IrreversibleMigration) do + migration.migrate(:down) + end + end + def test_migrate_up migration = InvertibleMigration.new migration.migrate(:up) |