diff init20.gradle @ 204:a3c507b868a9

merge
author smith@nwoca.org
date Mon, 31 Aug 2015 21:10:55 +0100
parents e90ce1d50d85 b217dc3b654a
children 55a2f489dbf7
line wrap: on
line diff
--- a/init20.gradle	Mon Aug 31 21:10:18 2015 +0100
+++ b/init20.gradle	Mon Aug 31 21:10:55 2015 +0100
@@ -300,7 +300,9 @@
                                 driverName)
                         if (dropIt) {
 							logger.info "disconnecting sessions from $databaseName"
-							sql.execute "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$databaseName';"
+							sql.execute "REVOKE CONNECT ON DATABASE \"" + databaseName + "\" FROM public;"
+							sql.execute "REVOKE CONNECT ON DATABASE \"" + databaseName + "\" FROM " + gradle.environmentDatabase.jdbc.username + ";"
+							sql.execute "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '" + databaseName + "';"
                             logger.info "dropping $databaseName (if exists) from $adminUrl"
                             sql.execute 'DROP DATABASE IF EXISTS "' + databaseName + '";'
                         }