From f84b24b856ea53c8ec4a4f5e9277e081d4c25a4c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 3 Feb 2019 00:14:19 +0100 Subject: [PATCH] Fix remove when there is still connections --- scripts/remove | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/remove b/scripts/remove index ff29209..e22f895 100755 --- a/scripts/remove +++ b/scripts/remove @@ -52,6 +52,9 @@ ynh_remove_systemd_config # REMOVE THE POSTGRESQL DATABASE #================================================= +ynh_psql_execute_as_root "\connect $db_name +SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_name';" + # Remove a database if it exists, along with the associated user ynh_psql_remove_db "$db_name" "$app"