aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-06 09:46:06 -0800
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-06 09:46:06 -0800
commitce8ac39338f86388e70356b3a470b3ea443802ae (patch)
tree6159084babd20c3db2e1b8f02dc15b697b1aeff8 /activerecord
parentb0e7b6f67c984d4b1502e801781ed75fad681633 (diff)
parentd2cc10c20000955da482e469078706793b310b01 (diff)
downloadrails-ce8ac39338f86388e70356b3a470b3ea443802ae.tar.gz
rails-ce8ac39338f86388e70356b3a470b3ea443802ae.tar.bz2
rails-ce8ac39338f86388e70356b3a470b3ea443802ae.zip
Merge pull request #8439 from joshsusser/fixes
Fixes issues in test_mysql2
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/schema_migration.rb6
-rw-r--r--activerecord/test/cases/migration_test.rb2
-rw-r--r--activerecord/test/cases/schema_migration_test.rb2
3 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb
index b2ae369eb6..6c3cd5b6ba 100644
--- a/activerecord/lib/active_record/schema_migration.rb
+++ b/activerecord/lib/active_record/schema_migration.rb
@@ -42,10 +42,10 @@ module ActiveRecord
end
def self.drop_table
- if connection.index_exists?(table_name, "version", :unique => true, :name => index_name)
- connection.remove_index(table_name, :name => index_name)
- end
if connection.table_exists?(table_name)
+ if connection.index_exists?(table_name, "version", :unique => true, :name => index_name)
+ connection.remove_index(table_name, :name => index_name)
+ end
connection.drop_table(table_name)
end
end
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index 60e5a29965..3a861d887f 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -71,7 +71,7 @@ class MigrationTest < ActiveRecord::TestCase
assert_equal m0_fingerprint, rows[0]["fingerprint"]
assert_equal "valid_people_have_last_names", rows[0]["name"]
rows.each do |row|
- assert_match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/, row["migrated_at"], "missing migrated_at")
+ assert_match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/, row["migrated_at"].to_s, "missing migrated_at") # sometimes a String, sometimes a Time
end
ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid")
diff --git a/activerecord/test/cases/schema_migration_test.rb b/activerecord/test/cases/schema_migration_test.rb
index 34b9fa520a..882067a7d4 100644
--- a/activerecord/test/cases/schema_migration_test.rb
+++ b/activerecord/test/cases/schema_migration_test.rb
@@ -40,7 +40,7 @@ class SchemaMigrationTest < ActiveRecord::TestCase
rows = connection.select_all("SELECT * FROM #{connection.quote_table_name(sm_table_name)}")
assert rows[0].has_key?("migrated_at"), "missing column `migrated_at`"
- assert_match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/, rows[0]["migrated_at"])
+ assert_match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/, rows[0]["migrated_at"].to_s) # sometimes a String, sometimes a Time
assert rows[0].has_key?("fingerprint"), "missing column `fingerprint`"
assert rows[0].has_key?("name"), "missing column `name`"
end