ci: let pgloader do all the clean and creation work

This commit is contained in:
Robert Sparks 2023-02-02 10:52:13 -06:00
parent a1185a8eeb
commit 2ebe85872c
No known key found for this signature in database
GPG key ID: 6E2A6A5775F91318

View file

@ -1,22 +1,22 @@
#!/bin/bash
set -e
echo "Drop dummy ietf DB if it exists..."
dropdb -U django --if-exists ietf
echo "Create new ietf DB..."
createdb -U django ietf
echo "Enable citext extension..."
psql -U django -d ietf -v ON_ERROR_STOP=1 -c '\x' -c 'CREATE EXTENSION IF NOT EXISTS citext;'
echo "Set schema search path for user django..."
psql -U django -d ietf -v ON_ERROR_STOP=1 -c '\x' -c 'ALTER USER django set search_path=ietf_utf8,django,public;'
#echo "Drop dummy ietf DB if it exists..."
#dropdb -U django --if-exists ietf
#
#echo "Create new ietf DB..."
#createdb -U django ietf
#
#echo "Enable citext extension..."
#psql -U django -d ietf -v ON_ERROR_STOP=1 -c '\x' -c 'CREATE EXTENSION IF NOT EXISTS citext;'
#
#echo "Set schema search path for user django..."
#psql -U django -d ietf -v ON_ERROR_STOP=1 -c '\x' -c 'ALTER USER django set search_path=ietf_utf8,django,public;'
echo "Import DB dump into ietf..."
pg_restore -U django -d ietf ietf.dump
pg_restore --clean --if-exists --create -U django -d ietf ietf.dump
echo "Set schema search path for user django..."
psql -U django -d ietf -v ON_ERROR_STOP=1 -c '\x' -c 'ALTER USER django set search_path=ietf_utf8,django,public;'
#echo "Set schema search path for user django..."
#psql -U django -d ietf -v ON_ERROR_STOP=1 -c '\x' -c 'ALTER USER django set search_path=ietf_utf8,django,public;'
echo "Done!"