From 117db3bfa116da8b78e89d02cc7db8a3026579e5 Mon Sep 17 00:00:00 2001
From: Andrew Kapuscinski <akapusci@nrao.edu>
Date: Mon, 9 Nov 2020 15:08:48 -0700
Subject: [PATCH] added ability to run-migrations with the capo profile as an
 argument

---
 schema/Dockerfile.local      |  6 +++---
 schema/bin/run-migrations.sh | 11 ++++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/schema/Dockerfile.local b/schema/Dockerfile.local
index 7a2365e50..81c4877c9 100644
--- a/schema/Dockerfile.local
+++ b/schema/Dockerfile.local
@@ -1,7 +1,7 @@
 # This is nrao:schema
 # The purpose of this is just to run the alembic migrations against the database in a docker-compose environment
-FROM nrao:workspaces-base
+FROM marconi.aoc.nrao.edu/ops/base:workspaces
+
 WORKDIR /code/schema
-ENV CAPO_PROFILE docker
 
-ENTRYPOINT ["./bin/run-migrations.sh"]
+ENTRYPOINT ["./bin/run-migrations.sh", "docker"]
diff --git a/schema/bin/run-migrations.sh b/schema/bin/run-migrations.sh
index e292f99f5..ee68be168 100755
--- a/schema/bin/run-migrations.sh
+++ b/schema/bin/run-migrations.sh
@@ -2,7 +2,16 @@
 
 # FOR USE WITH DOCKER DEVELOPMENT ENVIRONMENT ONLY.
 
+# failfast
+set -e
+set -o pipefail
+
+if [[ $# -eq 0 ]] ; then
+    echo 'ERROR: run-migrations requires an argument for CAPO_PROFILE'
+    exit 0
+fi
+
 # Python library installation
 pip install -r requirements.txt
 
-env CAPO_PROFILE=docker alembic upgrade head
+env CAPO_PROFILE=$1 alembic upgrade head
-- 
GitLab