File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
charts/inbox-server/templates Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,19 @@ spec:
4949 secretKeyRef :
5050 name : " {{ .Values.postgresql.auth.secretName }}"
5151 key : password
52+ command :
53+ - /bin/sh
5254 args :
53- - psql
5455 - -c
55- - " CREATE DATABASE {{ .Values.postgresql.auth.database }} WITH ENCODING 'UTF8' OWNER postgres;"
56+ - |
57+ DBNAME="{{ .Values.postgresql.auth.database }}";
58+ echo "Checking if database $DBNAME exists...";
59+ if [ "$(psql -tAc "SELECT 1 FROM pg_database WHERE datname='$DBNAME'" )" != "1" ]; then
60+ echo "Database $DBNAME does not exist. Creating...";
61+ psql -c "CREATE DATABASE $DBNAME WITH ENCODING 'UTF8' OWNER postgres;";
62+ else
63+ echo "Database $DBNAME already exists.";
64+ fi
5665 resources :
5766 {{- toYaml .Values.migrate.resources | nindent 12 }}
5867 {{- with .Values.migrate.nodeSelector }}
You can’t perform that action at this time.
0 commit comments