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:31:47 -0700 2008
commit  3532eaf92a96b87fb422625142ff0efa1cac17ab
tree    ab5cd93b583a79098d675217ab691b498cb9502c
parent  f94600bdaf7d73971ad9a53148b0844c2efb901d
...
553
554
555
556
 
 
 
 
 
 
 
 
 
557
558
559
...
553
554
555
 
556
557
558
559
560
561
562
563
564
565
566
567
0
@@ -553,7 +553,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