Run patches when creating the database

From now on we should only provide patches, not a patch and modify
the initial SQL and data. Otherwise we never test the patches.
This commit is contained in:
Andrew Ruthven 2024-01-21 17:47:23 +13:00
parent 27f19cb3b3
commit bc33199083

View File

@ -132,7 +132,7 @@ psql -qXAt ${PSQLOPTS} ${DBA} -f "${AWLDIR}/dba/schema-management.sql" "${DBNAME
psql -qXAt ${PSQLOPTS} ${DBA} -f "${DBADIR}/davical.sql" "${DBNAME}" 2>&1
#
# Set permissions for the application DB user on the database
# Set permissions for the application DB user on the database.
if ! ${DBADIR}/update-davical-database ${DBAOPTS} --dbuser "${AWL_DBAUSER}" --dbname "${DBNAME}" --appuser "${AWL_APPUSER}" --nopatch --owner "${AWL_DBAUSER}" ; then
cat <<EOFAILURE
* * * * ERROR * * * *
@ -152,6 +152,13 @@ fi
# Load the required base data
psql -qXAt ${PSQLOPTS} ${DBA} -f "${DBADIR}/base-data.sql" "${DBNAME}" | grep -E -v '^10'
# Apply any patches.
if ! ${DBADIR}/update-davical-database ${DBAOPTS} --dbuser "${AWL_DBAUSER}" --dbname "${DBNAME}" --appuser "${AWL_APPUSER}" --owner "${AWL_DBAUSER}" ; then
echo "Failed to patch database"
exit 1;
fi
#
# We can override the admin password generation for regression testing predictability
if [ "${ADMINPW}" = "" ] ; then