aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/invertible_migration_test.rb
diff options
context:
space:
mode:
authorChristopher Meiklejohn <christopher.meiklejohn@gmail.com>2011-07-29 21:26:21 -0400
committerXavier Noria <fxn@hashref.com>2011-08-13 16:22:27 -0700
commit9d19bae233d7a2ce9adac39b6b6e91de85729def (patch)
tree27d26b62fb6d90e2af6e862bbf27c5e207c9e48b /activerecord/test/cases/invertible_migration_test.rb
parent8293b10425bfe621b4bed85bf3db57cccd70e43b (diff)
downloadrails-9d19bae233d7a2ce9adac39b6b6e91de85729def.tar.gz
rails-9d19bae233d7a2ce9adac39b6b6e91de85729def.tar.bz2
rails-9d19bae233d7a2ce9adac39b6b6e91de85729def.zip
Support backwards compatible interface for migration down/up with rails 3.0.x.
Diffstat (limited to 'activerecord/test/cases/invertible_migration_test.rb')
-rw-r--r--activerecord/test/cases/invertible_migration_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/activerecord/test/cases/invertible_migration_test.rb b/activerecord/test/cases/invertible_migration_test.rb
index afec64750e..acba4a134e 100644
--- a/activerecord/test/cases/invertible_migration_test.rb
+++ b/activerecord/test/cases/invertible_migration_test.rb
@@ -27,6 +27,19 @@ module ActiveRecord
end
end
+ class LegacyMigration < ActiveRecord::Migration
+ def self.up
+ create_table("horses") do |t|
+ t.column :content, :text
+ t.column :remind_at, :datetime
+ end
+ end
+
+ def self.down
+ drop_table("horses")
+ end
+ end
+
def teardown
if ActiveRecord::Base.connection.table_exists?("horses")
ActiveRecord::Base.connection.drop_table("horses")
@@ -53,5 +66,16 @@ module ActiveRecord
migration.migrate :down
assert !migration.connection.table_exists?("horses")
end
+
+ def test_legacy_up
+ LegacyMigration.migrate :up
+ assert ActiveRecord::Base.connection.table_exists?("horses"), "horses should exist"
+ end
+
+ def test_legacy_down
+ LegacyMigration.migrate :up
+ LegacyMigration.migrate :down
+ assert !ActiveRecord::Base.connection.table_exists?("horses"), "horses should not exist"
+ end
end
end