mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Force disconnection of all clients connected to the database
This commit is contained in:
parent
ec48edfef8
commit
06a066fe17
1 changed files with 1 additions and 0 deletions
|
@ -105,6 +105,7 @@ ynh_psql_create_db() {
|
||||||
# Requires YunoHost version 3.?.? or higher.
|
# Requires YunoHost version 3.?.? or higher.
|
||||||
ynh_psql_drop_db() {
|
ynh_psql_drop_db() {
|
||||||
local db=$1
|
local db=$1
|
||||||
|
ynh_psql_execute_as_root --sql="SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db';" --database="$db"
|
||||||
sudo --login --user=postgres dropdb $db
|
sudo --login --user=postgres dropdb $db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue