Changeset 9004
- Timestamp:
- 03/10/08 11:42:01 (1 year ago)
- Files:
-
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/lib/tasks/databases.rake (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/railties/CHANGELOG
r8921 r9004 1 1 *SVN* 2 3 * Fix database rake tasks to work with charset/collation and show proper error messages on failure. Closes #11301 [matt] 2 4 3 5 * add a -e/--export to script/plugin install, uses svn export. #10847 [jon@blankpad.net)] trunk/railties/lib/tasks/databases.rake
r8876 r9004 38 38 begin 39 39 ActiveRecord::Base.establish_connection(config.merge({'database' => nil})) 40 ActiveRecord::Base.connection.create_database(config['database'], {:charset => @charset, :collation => @collation})40 ActiveRecord::Base.connection.create_database(config['database'], {:charset => (config['database']['charset'] || @charset), :collation => (config['database']['charset'] || @collation)}) 41 41 ActiveRecord::Base.establish_connection(config) 42 42 rescue 43 $stderr.puts "Couldn't create database for #{config.inspect} "43 $stderr.puts "Couldn't create database for #{config.inspect}, charset: #{@charset}, collation: #{@collation} (if you set the charset manually, make sure you have a matching collation)" 44 44 end 45 45 when 'postgresql' … … 69 69 desc 'Drops the database for the current RAILS_ENV' 70 70 task :drop => :environment do 71 drop_database(ActiveRecord::Base.configurations[RAILS_ENV || 'development']) 71 config = ActiveRecord::Base.configurations[RAILS_ENV || 'development'] 72 begin 73 drop_database(config) 74 rescue Exception => e 75 puts "Couldn't drop #{config['database']} : #{e.inspect}" 76 end 72 77 end 73 78