aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-01-13 16:09:47 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-01-13 16:09:47 -0800
commitb1e555142236a6b2fbb36bd80e5a0799e52e434b (patch)
tree5c739e8e6a7499229926f8ca650b610db0ee2614
parente0f0afb97572e80b0910302d983cf9fa8dabb268 (diff)
downloadrails-b1e555142236a6b2fbb36bd80e5a0799e52e434b.tar.gz
rails-b1e555142236a6b2fbb36bd80e5a0799e52e434b.tar.bz2
rails-b1e555142236a6b2fbb36bd80e5a0799e52e434b.zip
make sure the migration table is alive and empty
-rw-r--r--activerecord/lib/active_record/schema_migration.rb3
-rw-r--r--activerecord/test/cases/migration/logger_test.rb11
2 files changed, 12 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb
index 20e3cbb1f6..257963c2ce 100644
--- a/activerecord/lib/active_record/schema_migration.rb
+++ b/activerecord/lib/active_record/schema_migration.rb
@@ -20,8 +20,7 @@ module ActiveRecord
def self.drop_table
if connection.table_exists?(table_name)
- connection.remove_index table_name, :version, :unique => true,
- :name => "#{Base.table_name_prefix}unique_schema_migrations#{Base.table_name_suffix}"
+ connection.remove_index table_name, :name => "#{Base.table_name_prefix}unique_schema_migrations#{Base.table_name_suffix}"
connection.drop_table(table_name)
end
end
diff --git a/activerecord/test/cases/migration/logger_test.rb b/activerecord/test/cases/migration/logger_test.rb
index c12cdd5043..2a0b4f5598 100644
--- a/activerecord/test/cases/migration/logger_test.rb
+++ b/activerecord/test/cases/migration/logger_test.rb
@@ -9,6 +9,17 @@ module ActiveRecord
end
end
+ def setup
+ super
+ ActiveRecord::SchemaMigration.create_table
+ ActiveRecord::SchemaMigration.delete_all
+ end
+
+ def teardown
+ super
+ ActiveRecord::SchemaMigration.drop_table
+ end
+
def test_migration_should_be_run_without_logger
previous_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil