Skip to content
Snippets Groups Projects
Commit a5f9503d authored by Andrew Kapuscinski's avatar Andrew Kapuscinski
Browse files

simplified psql commands based on comments from Daniel

parent 0b989d1f
No related branches found
No related tags found
No related merge requests found
Pipeline #2216 passed
This commit is part of merge request !347. Comments created here will be created in the context of that merge request.
......@@ -50,7 +50,6 @@ cache:
# Build DB image
db:
docker build --no-cache -t ssa-containers.aoc.nrao.edu/ops/ci/db:workspaces -f ./ci/psql/Dockerfile.db .
docker build --no-cache -t ssa-containers.aoc.nrao.edu/ops/ci/db-ngas:workspaces -f ./ci/psql/Dockerfile.db-ngas .
# Build docker images
build: docker-base db cache
......
......@@ -7,12 +7,9 @@ DB=ngas
PATH_TO_SQL_FILE=/repos/ngas/src/ngamsCore/ngamsSql/ngamsCreateTables-PostgreSQL.sql
echo "Creating database '$DB' "
createdb -U $POSTGRES_USER -O $POSTGRES_USER $DB
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE $DB;
GRANT ALL PRIVILEGES ON DATABASE $DB TO archive;
EOSQL
echo "Populating database '$DB' "
psql -U $POSTGRES_USER -1 -d $DB -f $PATH_TO_SQL_FILE
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname $DB < $PATH_TO_SQL_FILE
echo "'$DB' was created successfully"
echo "'$DB' was created and populated successfully"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment