diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-01-20 13:14:24 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-01-20 13:14:24 +0100 |
commit | 6b2be718f69e73eb960a08898db517fc2f301df6 (patch) | |
tree | 677875f24112b67c87bce1bf67a45effb69231c4 /activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | |
parent | 04d1c3716b5bfa133a0b1ed937649a0829ac5f22 (diff) | |
parent | 48e99a45310f5fec515305e90ff8ee2a6a61bada (diff) | |
download | rails-6b2be718f69e73eb960a08898db517fc2f301df6.tar.gz rails-6b2be718f69e73eb960a08898db517fc2f301df6.tar.bz2 rails-6b2be718f69e73eb960a08898db517fc2f301df6.zip |
Merge pull request #18597 from kamipo/add-if-exists-to-drop-table
Add an `:if_exists` option to `drop_table`
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index a90adcf4aa..afd7a17c03 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -112,7 +112,7 @@ module ActiveRecord end def drop_table(table_name, options = {}) - execute "DROP TABLE #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}" + execute "DROP TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}" end # Returns true if schema exists. |