Class: ActiveRecord::Tasks::PostgreSQLDatabaseTasks

Inherits:
Object
  • Object
show all
Defined in:
lib/patches/postgresql_drop_replacement.rb

Instance Method Summary collapse

Instance Method Details

#dropObject

Allows drop on DBs currently in use.



5
6
7
8
9
# File 'lib/patches/postgresql_drop_replacement.rb', line 5

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