diff --git a/init b/init index f62f390..cc7694b 100755 --- a/init +++ b/init @@ -104,20 +104,24 @@ if [ "${role}" = "app" -a -e artisan ]; then su www-data -s /bin/sh -c "(php artisan optimize && php artisan view:cache)" fi - if [ -r .migrate ]; then - echo "* Running migration..." - # If DB_HOST not set, source the env file - [ -z "${DB_HOST}" -a -r .env ] && . .env + if [ -z "${IGNORE_MIGRATION}" ]; then + if [ -r .migrate ]; then + echo "* Running migration..." + # If DB_HOST not set, source the env file + [ -z "${DB_HOST}" -a -r .env ] && . .env - if [ -n "${DB_HOST}" -a -n "${DB_PORT}" ]; then - while ! wait-for-it -h ${DB_HOST} -p ${DB_PORT} -t 5 -q; do - echo "? Waiting for database at ${DB_HOST}:${DB_PORT}" - sleep 1; - done - echo "- DB is active on ${DB_HOST}:${DB_PORT}" + if [ -n "${DB_HOST}" -a -n "${DB_PORT}" ]; then + while ! wait-for-it -h ${DB_HOST} -p ${DB_PORT} -t 5 -q; do + echo "? Waiting for database at ${DB_HOST}:${DB_PORT}" + sleep 1; + done + echo "- DB is active on ${DB_HOST}:${DB_PORT}" + fi + + su www-data -s /bin/sh -c "php artisan migrate" && rm -f .migrate fi - - su www-data -s /bin/sh -c "php artisan migrate" && rm -f .migrate + else + [ -r .migrate ] && echo "! NOTE: Migration ignored due to IGNORE_MIGRATION" fi # If passport is installed