From a1ec4cd85bee09dfc08090f384b2d0c7cb278d84 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Thu, 30 Jun 2022 00:42:11 -0400 Subject: [PATCH 1/3] Update the dbwipe commands for parity with dbinit --- common/src/sql/dbwipe.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/sql/dbwipe.sql b/common/src/sql/dbwipe.sql index 40460bacb47..dcf7a78f4af 100644 --- a/common/src/sql/dbwipe.sql +++ b/common/src/sql/dbwipe.sql @@ -9,4 +9,5 @@ * initialization code and dbwipe.sql. */ DROP DATABASE IF EXISTS omicron; +ALTER DEFAULT PRIVILEGES FOR ROLE root REVOKE ALL ON TABLES FROM omicron; DROP USER IF EXISTS omicron; From 06ca2fc55404718ad756e0c272ffe1225bea6de2 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Thu, 30 Jun 2022 10:13:06 -0400 Subject: [PATCH 2/3] Do a silly thing --- common/src/sql/dbwipe.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/src/sql/dbwipe.sql b/common/src/sql/dbwipe.sql index dcf7a78f4af..148417ff255 100644 --- a/common/src/sql/dbwipe.sql +++ b/common/src/sql/dbwipe.sql @@ -9,5 +9,11 @@ * initialization code and dbwipe.sql. */ DROP DATABASE IF EXISTS omicron; + +/* + * This is silly, but we throw an error if the user was already deleted. + * Create the user so we can always delete it. + */ +CREATE USER IF NOT EXISTS omicron; ALTER DEFAULT PRIVILEGES FOR ROLE root REVOKE ALL ON TABLES FROM omicron; DROP USER IF EXISTS omicron; From 1d0b4c2afe116253e014e4a40c89b162c096e251 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Thu, 30 Jun 2022 10:17:42 -0400 Subject: [PATCH 3/3] Create the DB too --- common/src/sql/dbwipe.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/sql/dbwipe.sql b/common/src/sql/dbwipe.sql index 148417ff255..92f7b089dd8 100644 --- a/common/src/sql/dbwipe.sql +++ b/common/src/sql/dbwipe.sql @@ -8,12 +8,15 @@ * NOTE: the database and user names MUST be kept in sync with the * initialization code and dbwipe.sql. */ -DROP DATABASE IF EXISTS omicron; /* * This is silly, but we throw an error if the user was already deleted. * Create the user so we can always delete it. */ +CREATE DATABASE IF NOT EXISTS omicron; CREATE USER IF NOT EXISTS omicron; + ALTER DEFAULT PRIVILEGES FOR ROLE root REVOKE ALL ON TABLES FROM omicron; + +DROP DATABASE IF EXISTS omicron; DROP USER IF EXISTS omicron;