Mercurial > public > ssdt-docker
changeset 590:80f3564f2553 production v2.20.0
flow: Merged <release> '2.20.0' to <master> ('production').
author | Marc Davis <marc.davis@mcoecn.org> |
---|---|
date | Thu, 05 Sep 2024 15:01:40 -0400 |
parents | 2bd96ab37a7a (current diff) 208f77b60b78 (diff) |
children | 9f77e0438846 |
files | |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/backup-container-docker.sh Thu Sep 05 14:09:51 2024 -0400 +++ b/scripts/backup-container-docker.sh Thu Sep 05 15:01:40 2024 -0400 @@ -1,5 +1,5 @@ #!/bin/bash -# Executes a database backup for the specifed database container. +# Executes a database backup for the specified database container. # The current directory is expected to contain a project configured # as with SSDT conventions for an application database. # @@ -64,7 +64,15 @@ } entityId=$(prop 'entityId' | tr -d '"') containerName="$entityId-ess-db" - backupFile=./backup/${entityId}-ess-db.$(date +%Y-%m-%d-%H-%M-%S).backup + IRN=$(docker exec $containerName psql --username=postgres --dbname=$container -t -c 'select irn from organization') + ## if database is empty, it will put IRN 000000 + if [ "$IRN" == "" ]; then + echo "no IRN set, using 000000" + IRN=000000 + fi + ##Take out the extra space from IRN returned from db. + IRN=`echo $IRN | sed -e 's/^[[:space:]]*//'` + backupFile=./backup/${IRN}${entityId}-ess-db.$(date +%Y-%m-%d-%H-%M-%S).backup echo "entityId is $entityId" echo "container name is $containerName" fi