45 lines
1.5 KiB
Bash
45 lines
1.5 KiB
Bash
#!/bin/sh
|
|
#
|
|
echo "Started..."
|
|
#Started...
|
|
#
|
|
# special variable $# is the number of arguments
|
|
if [ $# -lt 3 ] ; then
|
|
echo 'Call ./<script> <db name> <db user> <db schema>'
|
|
exit 1
|
|
fi
|
|
#
|
|
DB_NAME="$1"
|
|
echo "DB_NAME: ${DB_NAME}"
|
|
DB_USER="$2"
|
|
echo "DB_USER: ${DB_USER}"
|
|
DB_SCHEMA="$3"
|
|
echo "DB_SCHEMA: ${DB_SCHEMA}"
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/join-gncy-rts.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/rts-cnt.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/join-gncy-rts-trps.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/rts-trps-cnt.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/services.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/join-gncy-rts-trps-stptms.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/join-gncy-rts-trps-stptms-stps.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/stps-cnt.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/rts-stps-trps-cnt.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/join-gncy-rts-trps-srvcs.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/trip-updates.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
psql -h localhost -p 5432 -U $DB_USER -f ./sql/join-gncy-rts-trps-srvcs-pdts.sql -d $DB_NAME -v schema=$DB_SCHEMA
|
|
#
|
|
echo "Done."
|
|
#done.
|