diff options
author | Christopher Meiklejohn <christopher.meiklejohn@gmail.com> | 2011-07-29 21:26:21 -0400 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-02 18:55:59 -0700 |
commit | 74d7bfb200e4590e244558554e147a31d30990df (patch) | |
tree | 1402f8eebcae92c9566607a28ce8814f1b7a7651 /activerecord/test/cases | |
parent | 3a4dc9d34c1cde8bf34dfa4b4600fb8bcef9eb45 (diff) | |
download | rails-74d7bfb200e4590e244558554e147a31d30990df.tar.gz rails-74d7bfb200e4590e244558554e147a31d30990df.tar.bz2 rails-74d7bfb200e4590e244558554e147a31d30990df.zip |
Support backwards compatible interface for migration down/up with rails 3.0.x.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/invertible_migration_test.rb | 24 |
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 |