aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema_migration.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-01-30 20:52:33 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-01-30 20:52:33 +0900
commit4e551d05c9ddfc13812d8c8d87f277d1aac371c4 (patch)
treec868e59dc467d4fe265f52b65fbf69edfa278e54 /activerecord/lib/active_record/schema_migration.rb
parent6162c49e40582bf058a6bb82ccc0cfb8f92332b6 (diff)
downloadrails-4e551d05c9ddfc13812d8c8d87f277d1aac371c4.tar.gz
rails-4e551d05c9ddfc13812d8c8d87f277d1aac371c4.tar.bz2
rails-4e551d05c9ddfc13812d8c8d87f277d1aac371c4.zip
Make `SchemaMigration.drop_table` to one SQL
`SchemaMigration.drop_table` is only used in tests. Simply we can use `drop_table if_exists: true`.
Diffstat (limited to 'activerecord/lib/active_record/schema_migration.rb')
-rw-r--r--activerecord/lib/active_record/schema_migration.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb
index ee4c71f304..8f0ab2b55b 100644
--- a/activerecord/lib/active_record/schema_migration.rb
+++ b/activerecord/lib/active_record/schema_migration.rb
@@ -37,10 +37,7 @@ module ActiveRecord
end
def drop_table
- if table_exists?
- connection.remove_index table_name, name: index_name
- connection.drop_table(table_name)
- end
+ connection.drop_table table_name, if_exists: true
end
def normalize_migration_number(number)