Skip to content

Commit

Permalink
Only use DROP ... IF EXISTS for PostgreSQL 8.2 or later. [#400 state:…
Browse files Browse the repository at this point in the history
…resolved]
  • Loading branch information
iwarshak authored and jeremy committed Jun 23, 2008
1 parent 7839a83 commit 965848e
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 965848e

Please sign in to comment.