Configure staging test environment

This commit is contained in:
Jesse C. Fisher 2015-12-29 21:59:18 -08:00
parent bf7d1e5689
commit 11f66823eb
2 changed files with 13 additions and 1 deletions

View File

@ -36,7 +36,8 @@ set :nginx_listen, 80 # optional, default is not set
set :nginx_roles, :all
## postgresql
#set :pg_user, "thirteen_tien_len_#{fetch(:stage)}"
set :pg_user, "thirteen_tien_len_#{fetch(:stage)}"
set :pg_database, "thirteen_tien_len_#{fetch(:stage)}"
namespace :db do
desc 'Setup the database'

View File

@ -0,0 +1,11 @@
module ActiveRecord
module Tasks
class PostgreSQLDatabaseTasks
def drop
establish_master_connection
connection.select_all "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname='#{configuration['database']}' AND state='idle';"
connection.drop_database configuration['database']
end
end
end
end