Skip to content

Commit 3363468

Browse files
committed
Metabase: add db cleanup script
To be executed when removing metabase from deployment. This script will remove all metabase-related records from DB * ITISFoundation#1093
1 parent d8aed21 commit 3363468

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

services/metabase/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
configure_metabase.sql
2+
remove_metabase.sql
23
docker-compose.yml

services/metabase/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ docker-compose.yml: docker-compose.yml.j2 .env venv
2828
configure_metabase.sql: .env
2929
@set -o allexport; source $<; set +o allexport; \
3030
envsubst < $@.template > $@
31+
32+
remove_metabase.sql: .env
33+
@set -o allexport; source $<; set +o allexport; \
34+
envsubst < $@.template > $@
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- need to be executed while connected as ${METABASE_POSTGRES_USER} user
2+
DROP DATABASE ${METABASE_POSTGRES_DB};
3+
4+
/*
5+
need to be executed while connected to ${POSTGRES_DB} database
6+
as ${POSTGRES_USER} user
7+
*/
8+
9+
REVOKE SELECT ON TABLE ${METABASE_POSTGRES_ALLOWED_SIMCORE_TABLES} FROM ${METABASE_POSTGRES_USER};
10+
11+
REVOKE USAGE ON SCHEMA public FROM ${METABASE_POSTGRES_USER};
12+
13+
REVOKE CONNECT ON DATABASE ${POSTGRES_DB} FROM ${METABASE_POSTGRES_USER};
14+
15+
DROP USER ${METABASE_POSTGRES_USER};

0 commit comments

Comments
 (0)