-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-3380 | Add script to update openmrs and elis host and port for at…
…omfeed sync (#95)
- Loading branch information
Showing
3 changed files
with
27 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set +e | ||
|
||
run_sql() { | ||
PGPASSWORD="${ODOO_DB_PASSWORD}" psql --host="${ODOO_DB_SERVER}" -U "${ODOO_DB_USERNAME}" -d odoo -t -c "$1" | ||
} | ||
|
||
if [ $(run_sql "select count(*) from information_schema.tables where table_name='markers' and table_schema='public';") -gt 0 ] | ||
then | ||
echo "Updating OpenMRS Host Port in markers and failed_events table" | ||
run_sql "UPDATE markers SET feed_uri_for_last_read_entry = regexp_replace(feed_uri_for_last_read_entry, 'http://.*/openmrs', 'http://${OPENMRS_HOST}:${OPENMRS_PORT}/openmrs'),feed_uri = regexp_replace(feed_uri, 'http://.*/openmrs', 'http://${OPENMRS_HOST}:${OPENMRS_PORT}/openmrs') where feed_uri ~ 'openmrs';" | ||
run_sql "UPDATE failed_events SET feed_uri = regexp_replace(feed_uri, 'http://.*/openmrs', 'http://${OPENMRS_HOST}:${OPENMRS_PORT}/openmrs') where feed_uri ~'openmrs';" | ||
|
||
echo "Updating OpenELIS Host Port in markers and failed_events table" | ||
run_sql "UPDATE markers SET feed_uri_for_last_read_entry = regexp_replace(feed_uri_for_last_read_entry, 'http://.*/openelis', 'http://${OPENELIS_HOST}:${OPENELIS_PORT}/openelis'),feed_uri = regexp_replace(feed_uri, 'http://.*/openelis', 'http://${OPENELIS_HOST}:${OPENELIS_PORT}/openelis') where feed_uri ~ 'openelis';" | ||
run_sql "UPDATE failed_events SET feed_uri = regexp_replace(feed_uri, 'http://.*/openelis', 'http://${OPENELIS_HOST}:${OPENELIS_PORT}/openelis') where feed_uri ~'openelis';" | ||
fi |