diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-02-20 00:10:50 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-02-20 00:10:50 +0900 |
commit | 48cfb003b717c5494fb2f4d3eb10c1b339f9f05e (patch) | |
tree | 4e7a314e30c12d020d59369eb0984668729bea2a /activerecord/lib/active_record | |
parent | e51572dce00c5f011f019397984ed8e82d94fc84 (diff) | |
download | rails-48cfb003b717c5494fb2f4d3eb10c1b339f9f05e.tar.gz rails-48cfb003b717c5494fb2f4d3eb10c1b339f9f05e.tar.bz2 rails-48cfb003b717c5494fb2f4d3eb10c1b339f9f05e.zip |
Improve `create_table force: true`
Extra `data_source_exists?(table_name)` is unneeded if
`drop_table(table_name, if_exists: true)` directly.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index bdcdfe4982..3686ad8b54 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -273,8 +273,8 @@ module ActiveRecord yield td if block_given? - if options[:force] && data_source_exists?(table_name) - drop_table(table_name, options) + if options[:force] + drop_table(table_name, **options, if_exists: true) end result = execute schema_creation.accept td |