Permalink
Browse files

There is em_postgresql also.

  • Loading branch information...
1 parent 7cfa388 commit 397c9f997accfc925a7ca6469aea439c497c4cf3 @neglectedvalue committed Jan 14, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 padrino-gen/lib/padrino-gen/padrino-tasks/activerecord.rb
View
8 padrino-gen/lib/padrino-gen/padrino-tasks/activerecord.rb
@@ -69,7 +69,7 @@ def create_database(config)
$stderr.puts "Couldn't create database for #{config.inspect}, charset: #{config[:charset] || @charset}, collation: #{config[:collation] || @collation}"
$stderr.puts "(if you set the charset manually, make sure you have a matching collation)" if config[:charset]
end
- when 'postgresql'
+ when 'postgresql', 'em_postgresql'
@encoding = config[:encoding] || ENV['CHARSET'] || 'utf8'
begin
ActiveRecord::Base.establish_connection(config.merge(:database => 'postgres', :schema_search_path => 'public'))
@@ -187,7 +187,7 @@ def local_database?(config, &block)
when 'mysql', 'mysql2', 'jdbcmysql'
ActiveRecord::Base.establish_connection(config)
puts ActiveRecord::Base.connection.charset
- when 'postgresql'
+ when 'postgresql', 'em_postgresql'
ActiveRecord::Base.establish_connection(config)
puts ActiveRecord::Base.connection.encoding
else
@@ -259,7 +259,7 @@ def local_database?(config, &block)
when "mysql", "mysql2", "oci", "oracle", 'jdbcmysql'
ActiveRecord::Base.establish_connection(abcs[Padrino.env])
File.open("#{Padrino.root}/db/#{Padrino.env}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
- when "postgresql"
+ when "postgresql", "em_postgresql"
ENV['PGHOST'] = abcs[Padrino.env][:host] if abcs[Padrino.env][:host]
ENV['PGPORT'] = abcs[Padrino.env][:port].to_s if abcs[Padrino.env][:port]
ENV['PGPASSWORD'] = abcs[Padrino.env][:password].to_s if abcs[Padrino.env][:password]
@@ -346,7 +346,7 @@ def drop_database(config)
file = path.absolute? ? path.to_s : Padrino.root(path)
FileUtils.rm(file)
- when 'postgresql'
+ when 'postgresql', 'em_postgresql'
ActiveRecord::Base.establish_connection(config.merge(:database => 'postgres', :schema_search_path => 'public'))
ActiveRecord::Base.connection.drop_database config[:database]
end

0 comments on commit 397c9f9

Please sign in to comment.