Configure staging test environment
This commit is contained in:
parent
bf7d1e5689
commit
11f66823eb
@ -36,7 +36,8 @@ set :nginx_listen, 80 # optional, default is not set
|
|||||||
set :nginx_roles, :all
|
set :nginx_roles, :all
|
||||||
|
|
||||||
## postgresql
|
## 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
|
namespace :db do
|
||||||
desc 'Setup the database'
|
desc 'Setup the database'
|
||||||
|
|||||||
11
config/initializers/postgresql_database_tasks.rb
Normal file
11
config/initializers/postgresql_database_tasks.rb
Normal 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
|
||||||
Loading…
x
Reference in New Issue
Block a user