aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2015-01-21 02:46:07 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2015-01-21 16:17:34 +0000
commited3c38c7aa2653ddba67ad12926ac158fbdf6c32 (patch)
treef80e14398c2882be845431b106259e1b06ded860
parentbe9b68038e83a617eb38c26147659162e4ac3d2c (diff)
downloadrails-ed3c38c7aa2653ddba67ad12926ac158fbdf6c32.tar.gz
rails-ed3c38c7aa2653ddba67ad12926ac158fbdf6c32.tar.bz2
rails-ed3c38c7aa2653ddba67ad12926ac158fbdf6c32.zip
Replace `if exists` with `table_exists?` and drop table statement with `drop_table`
since 'drop table if exists' statement does not always work with some databases such as Oracle. also Oracle drop table statement will not drop sequence objects.
-rw-r--r--activerecord/test/cases/migration/references_foreign_key_test.rb4
-rw-r--r--activerecord/test/cases/primary_keys_test.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/cases/migration/references_foreign_key_test.rb b/activerecord/test/cases/migration/references_foreign_key_test.rb
index bba8897a0d..99de7db70c 100644
--- a/activerecord/test/cases/migration/references_foreign_key_test.rb
+++ b/activerecord/test/cases/migration/references_foreign_key_test.rb
@@ -10,8 +10,8 @@ module ActiveRecord
end
teardown do
- @connection.execute("drop table if exists testings")
- @connection.execute("drop table if exists testing_parents")
+ @connection.drop_table("testings") if @connection.table_exists? "testings"
+ @connection.drop_table("testing_parents") if @connection.table_exists? "testing_parents"
end
test "foreign keys can be created with the table" do
diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb
index 751eccc015..4b668f84dd 100644
--- a/activerecord/test/cases/primary_keys_test.rb
+++ b/activerecord/test/cases/primary_keys_test.rb
@@ -210,7 +210,7 @@ class PrimaryKeyAnyTypeTest < ActiveRecord::TestCase
end
teardown do
- @connection.execute("DROP TABLE IF EXISTS barcodes")
+ @connection.drop_table(:barcodes) if @connection.table_exists? :barcodes
end
def test_any_type_primary_key