Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion deployment/entrypoint.d/600_init_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

#assumes database was created (300-ensure-database script)

initialize_database() {
# START SECTION db init - if you edit these lines manually note that your change will get lost if you run the IQGeo Project Update tool
if ! myw_db $MYW_DB_NAME list versions --layout keys | grep myw_comms_schema | grep version=; then myw_db $MYW_DB_NAME install comms; fi
# END SECTION
# END SECTION
}

log "Checking for shared-directory..."

if [ -n "${SHARED_DIRECTORY}" ]; then
log "Found shared-directory, attempting to lock 600_init_db..."
LOCKFILE="${SHARED_DIRECTORY}/600_init_db.lock"

(
if ! flock -n 200; then
flock 200
fi

initialize_database

) 200>"${LOCKFILE}"
else
log "shared-directory not found, initializing database."
initialize_database
fi
20 changes: 19 additions & 1 deletion deployment/entrypoint.d/610_upgrade_db.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
#!/bin/bash

upgrade_database() {
if [ "${MYW_DB_UPGRADE}" == "YES" ]; then
# START SECTION db upgrade - if you edit these lines manually note that your change will get lost if you run the IQGeo Project Update tool
if myw_db $MYW_DB_NAME list versions --layout keys | grep myw_comms_schema | grep version=; then myw_db $MYW_DB_NAME upgrade comms; fi
# END SECTION
fi
fi
}

if [ -n "${SHARED_DIRECTORY}" ]; then
log "Found shared-directory, attempting to lock 610_upgrade_db..."
LOCKFILE="${SHARED_DIRECTORY}/610_upgrade_db.lock"
(
if ! flock -n 200; then
flock 200
fi

upgrade_database

) 200>"${LOCKFILE}"
else
log "shared-directory not found, upgrading database."
upgrade_database
fi