diff --git a/lib/capistrano/tasks/postgresql.rake b/lib/capistrano/tasks/postgresql.rake index d2ba545..967817f 100644 --- a/lib/capistrano/tasks/postgresql.rake +++ b/lib/capistrano/tasks/postgresql.rake @@ -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 @@ -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 @@ -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'