Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dm:create and dm:drop did not pass the arguments to the #system correctly #1279

Merged
merged 1 commit into from May 16, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions padrino-gen/lib/padrino-gen/padrino-tasks/datamapper.rb
Expand Up @@ -58,7 +58,12 @@
puts "=> Creating database '#{database}'"
case config[:adapter]
when 'postgres'
system("createdb", "-E", charset, "-h", host, "-U", user, database)
arguments = []
arguments << "--encoding=#{charset}" if charset
arguments << "--host=#{host}" if host
arguments << "--username=#{user}" if user
arguments << database
system("createdb", *arguments)
puts "<= dm:create executed"
when 'mysql'
arguments = ["--user=#{user}"]
Expand Down Expand Up @@ -88,7 +93,11 @@
puts "=> Dropping database '#{database}'"
case config[:adapter]
when 'postgres'
system("dropdb", "-h", host, "-U", user, database)
arguments = []
arguments << "--host=#{host}" if host
arguments << "--username=#{user}" if user
arguments << database
system("dropdb", *arguments)
puts "<= dm:drop executed"
when 'mysql'
arguments = ["--user=#{user}"]
Expand Down