diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-05-06 12:16:55 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-05-06 12:16:55 +0100 |
commit | 63e8bcaeb31443cecc5bef5762a45643cc12d481 (patch) | |
tree | 57800132eecace875b1701b79883d179dfb8c021 /railties/lib | |
parent | 4a0118d7278687b534edf1e1184d6858cb4d29b8 (diff) | |
parent | e520fd5db7cb839b862c03647effee50f9223d98 (diff) | |
download | rails-63e8bcaeb31443cecc5bef5762a45643cc12d481.tar.gz rails-63e8bcaeb31443cecc5bef5762a45643cc12d481.tar.bz2 rails-63e8bcaeb31443cecc5bef5762a45643cc12d481.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/tasks/databases.rake | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index 20fdcce205..63f71448f8 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -46,7 +46,7 @@ namespace :db do @encoding = config[:encoding] || ENV['CHARSET'] || 'utf8' begin ActiveRecord::Base.establish_connection(config.merge('database' => 'template1')) - ActiveRecord::Base.connection.create_database(config['database'], :encoding => @encoding) + ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => @encoding)) ActiveRecord::Base.establish_connection(config) rescue $stderr.puts $!, *($!.backtrace) @@ -314,14 +314,9 @@ namespace :db do ActiveRecord::Base.establish_connection(:test) ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"]) when "postgresql" - ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"] - ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"] - ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"] - enc_option = "-E #{abcs["test"]["encoding"]}" if abcs["test"]["encoding"] - ActiveRecord::Base.clear_active_connections! - `dropdb -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` - `createdb #{enc_option} -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` + drop_database(abcs['test']) + create_database(abcs['test']) when "sqlite","sqlite3" dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"] File.delete(dbfile) if File.exist?(dbfile) |