From e8d04c363d3bdfe74ccf71387a8c520c6570b7ea Mon Sep 17 00:00:00 2001 From: BillMills Date: Sat, 22 Jun 2019 13:38:16 -0400 Subject: [PATCH] aaand the db init script --- bulletin-board-db/init-db.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bulletin-board-db/init-db.sh b/bulletin-board-db/init-db.sh index 58db756..7a3ac84 100644 --- a/bulletin-board-db/init-db.sh +++ b/bulletin-board-db/init-db.sh @@ -1,3 +1,10 @@ -sleep 30s +#!/bin/bash +set -e -/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P DockerCon!!! -i init-db.sql \ No newline at end of file +psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL + CREATE TABLE Events(Id SERIAL, Title TEXT, Detail TEXT, Date DATE); + INSERT INTO Events (Title, Detail, Date) VALUES + ('Docker for Beginners', 'Introduction to Docker using Node.js', '2017-11-21'), + ('Advanced Orchestration', 'Deep dive into Docker Swarm', '2017-12-25'), + ('Docker on Windows', 'From 101 to production', '2018-01-01'); +EOSQL \ No newline at end of file