aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-03-02 17:35:05 +0100
committerYves Senn <yves.senn@gmail.com>2015-03-02 17:43:01 +0100
commit3f4964299acd1351a519293991b97dd78b775073 (patch)
treebc9312a08fae97e2b9d810c9d34653ffd0a62c15 /activerecord/test/schema
parente20dc1b313303540b44effd94fbc8cf39121ad28 (diff)
downloadrails-3f4964299acd1351a519293991b97dd78b775073.tar.gz
rails-3f4964299acd1351a519293991b97dd78b775073.tar.bz2
rails-3f4964299acd1351a519293991b97dd78b775073.zip
tests, favor `drop_table` and `:if_exists` over raw SQL.
We've replaced most querues using DROP TABLE in our tests already. This patch replaces the last couple calls.
Diffstat (limited to 'activerecord/test/schema')
-rw-r--r--activerecord/test/schema/mysql2_specific_schema.rb8
-rw-r--r--activerecord/test/schema/mysql_specific_schema.rb8
2 files changed, 4 insertions, 12 deletions
diff --git a/activerecord/test/schema/mysql2_specific_schema.rb b/activerecord/test/schema/mysql2_specific_schema.rb
index a9a6514c9d..d6fd0c4ab0 100644
--- a/activerecord/test/schema/mysql2_specific_schema.rb
+++ b/activerecord/test/schema/mysql2_specific_schema.rb
@@ -35,9 +35,7 @@ BEGIN
END
SQL
- ActiveRecord::Base.connection.execute <<-SQL
-DROP TABLE IF EXISTS collation_tests;
-SQL
+ ActiveRecord::Base.connection.drop_table "collation_tests", if_exists: true
ActiveRecord::Base.connection.execute <<-SQL
CREATE TABLE collation_tests (
@@ -46,9 +44,7 @@ CREATE TABLE collation_tests (
) CHARACTER SET utf8 COLLATE utf8_general_ci
SQL
- ActiveRecord::Base.connection.execute <<-SQL
-DROP TABLE IF EXISTS enum_tests;
-SQL
+ ActiveRecord::Base.connection.drop_table "enum_tests", if_exists: true
ActiveRecord::Base.connection.execute <<-SQL
CREATE TABLE enum_tests (
diff --git a/activerecord/test/schema/mysql_specific_schema.rb b/activerecord/test/schema/mysql_specific_schema.rb
index f2cffca52c..b5378341b5 100644
--- a/activerecord/test/schema/mysql_specific_schema.rb
+++ b/activerecord/test/schema/mysql_specific_schema.rb
@@ -46,9 +46,7 @@ BEGIN
END
SQL
- ActiveRecord::Base.connection.execute <<-SQL
-DROP TABLE IF EXISTS collation_tests;
-SQL
+ ActiveRecord::Base.connection.drop_table "collation_tests", if_exists: true
ActiveRecord::Base.connection.execute <<-SQL
CREATE TABLE collation_tests (
@@ -57,9 +55,7 @@ CREATE TABLE collation_tests (
) CHARACTER SET utf8 COLLATE utf8_general_ci
SQL
- ActiveRecord::Base.connection.execute <<-SQL
-DROP TABLE IF EXISTS enum_tests;
-SQL
+ ActiveRecord::Base.connection.drop_table "enum_tests", if_exists: true
ActiveRecord::Base.connection.execute <<-SQL
CREATE TABLE enum_tests (