generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update GL_Code on docker startup and refresh DB
- Loading branch information
Showing
5 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
database/mssql/scripts/sampledata/permit.ORBC_PERMIT_TYPE.Table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SET NOCOUNT ON | ||
GO | ||
UPDATE [permit].[ORBC_PERMIT_TYPE] SET GL_CODE='$(GL_CODE)' WHERE PERMIT_TYPE= '$(PERMIT_TYPE)' | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Retrieve arguments | ||
source ${SCRIPT_DIR}/utility/getopt.sh | ||
USAGE="-u ORBC_USER -p ORBC_PASS -s ORBC_SERVER -d ORBC_DATABASE" | ||
parse_options "${USAGE}" ${@} | ||
|
||
# Clear out all records from the pending IDIR users table | ||
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; UPDATE permit.ORBC_PERMIT_TYPE SET GL_CODE=NULL" | ||
|
||
( | ||
# PAYBC_GL_CODE environment variable must be a string representing an array | ||
# of tuples in the format PERMIT_TUPE,GL_CODE separated by single space characters. | ||
# For example "TROS,000.00000.00000.0000.0000000.000000.0000 TROW,EOF000.00000.00000.0000.0000000.000000.0000" | ||
for i in ${PAYBC_GL_CODE} | ||
do | ||
IFS=","; set -- $i | ||
echo "Updating permit type ${1} with GL_CODE ${2}" | ||
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -v PERMIT_TYPE=${1} GL_CODE=${2} -i ${SCRIPT_DIR}/sampledata/permit.ORBC_PERMIT_TYPE.Table.sql | ||
done | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters