From 3f4964299acd1351a519293991b97dd78b775073 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 2 Mar 2015 17:35:05 +0100 Subject: 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. --- activerecord/test/schema/mysql2_specific_schema.rb | 8 ++------ activerecord/test/schema/mysql_specific_schema.rb | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'activerecord/test/schema') 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 ( -- cgit v1.2.3