Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only use DROP ... IF EXISTS for PostgreSQL 8.2 or later. [#400 state:…

…resolved]
  • Loading branch information...
commit 965848ec61529df53f137bf877fb36abd786da8c 1 parent 7839a83
@iwarshak iwarshak authored jeremy committed
View
10 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -529,7 +529,15 @@ def create_database(name, options = {})
# Example:
# drop_database 'matt_development'
def drop_database(name) #:nodoc:
- execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}"
+ if postgresql_version >= 80200
+ execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}"
+ else
+ begin
+ execute "DROP DATABASE #{quote_table_name(name)}"
+ rescue ActiveRecord::StatementInvalid
+ @logger.warn "#{name} database doesn't exist." if @logger
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.