Class: ActiveRecord::Tasks::PostgreSQLDatabaseTasks
- Inherits:
-
Object
- Object
- ActiveRecord::Tasks::PostgreSQLDatabaseTasks
- Defined in:
- lib/patches/postgresql_drop_replacement.rb
Instance Method Summary collapse
-
#drop ⇒ Object
Allows drop on DBs currently in use.
Instance Method Details
#drop ⇒ Object
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 |