Skip to content

Commit

Permalink
issues/44: Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
NorseGaud committed Dec 18, 2017
1 parent b2fbd0e commit 9c29400
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/capistrano/tasks/postgresql.rake
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace :postgresql do
task :create_database do
on roles :db do
next if database_exists?
unless psql_on_db fetch(:pg_database), '-c', %Q{"CREATE DATABASE \\"#{fetch(:pg_database)}\\" OWNER \\"#{fetch(:pg_user)}\\";"}
unless psql_on_db fetch(:pg_system_db), '-c', %Q{"CREATE DATABASE \\"#{fetch(:pg_database)}\\" OWNER \\"#{fetch(:pg_user)}\\";"}
error 'postgresql: creating database failed!'
exit 1
end
Expand All @@ -128,7 +128,7 @@ namespace :postgresql do
on roles :db do
next if db_user_exists?
# If you use CREATE USER instead of CREATE ROLE the LOGIN right is granted automatically; otherwise you must specify it in the WITH clause of the CREATE statement.
unless psql_on_db fetch(:pg_database), '-c', %Q{"CREATE USER \\"#{fetch(:pg_user)}\\" PASSWORD '#{fetch(:pg_password)}';"}
unless psql_on_db fetch(:pg_system_db), '-c', %Q{"CREATE USER \\"#{fetch(:pg_user)}\\" PASSWORD '#{fetch(:pg_password)}';"}
error 'postgresql: creating database user failed!'
exit 1
end
Expand Down Expand Up @@ -171,8 +171,8 @@ namespace :postgresql do
task :setup do
puts "* ============================= * \n All psql commands will be run #{fetch(:pg_without_sudo) ? 'without sudo' : 'with sudo'}\n You can modify this in your deploy/{env}.rb by setting the pg_without_sudo boolean \n* ============================= *"
invoke 'postgresql:remove_yml_files' # Delete old yml files. Allows you to avoid having to manually delete the files on your web/app servers to get a new pool size for example.
invoke 'postgresql:create_database'
invoke 'postgresql:create_db_user'
invoke 'postgresql:create_database'
invoke 'postgresql:add_hstore'
invoke 'postgresql:add_extensions'
invoke 'postgresql:generate_database_yml_archetype'
Expand Down

0 comments on commit 9c29400

Please sign in to comment.