public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Only use DROP ... IF EXISTS for PostgreSQL 8.2 or later.  [#400 
state:resolved]
iwarshak (author)
Mon Jun 16 15:45:50 -0700 2008
jeremy (committer)
Sun Jun 22 18:32:19 -0700 2008
commit  965848ec61529df53f137bf877fb36abd786da8c
tree    54d253d261d59ad708120cebefe064bd1dffb44f
parent  7839a83227d0d7cb193f0599afc03829d4643a64
...
529
530
531
532
 
 
 
 
 
 
 
 
 
533
534
535
...
529
530
531
 
532
533
534
535
536
537
538
539
540
541
542
543
0
@@ -529,7 +529,15 @@ module ActiveRecord
0
       # Example:
0
       # drop_database 'matt_development'
0
       def drop_database(name) #:nodoc:
0
- execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}"
0
+ if postgresql_version >= 80200
0
+ execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}"
0
+ else
0
+ begin
0
+ execute "DROP DATABASE #{quote_table_name(name)}"
0
+ rescue ActiveRecord::StatementInvalid
0
+ @logger.warn "#{name} database doesn't exist." if @logger
0
+ end
0
+ end
0
       end
0
 
0
 

Comments

    No one has commented yet.