From 48ca02b3f19c59fd25b3382a9a2a53653fcf849d Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Sun, 5 Oct 2025 02:33:47 +0200 Subject: [PATCH] new: [opensem] add automatic database migration --- opensem/hooks/pre_deploy | 3 +++ opensem/lib/common | 13 ++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/opensem/hooks/pre_deploy b/opensem/hooks/pre_deploy index 11358bb..48bf89e 100755 --- a/opensem/hooks/pre_deploy +++ b/opensem/hooks/pre_deploy @@ -5,3 +5,6 @@ set -e mv -v "${OPENSEM_CONFIG_FILE}" "${OPENSEM_CONFIG_FILE%.prepare}" + +#artisan migrate -v --force && +#artisan migrate -v --path=database/migrations/shop --force diff --git a/opensem/lib/common b/opensem/lib/common index 2408bb0..5f0c502 100644 --- a/opensem/lib/common +++ b/opensem/lib/common @@ -110,17 +110,16 @@ artisan() { export COMPOSE_IGNORE_ORPHANS=true + mysql_service=$(service:traverse "$SERVICE_NAME":mysql-database) || return 1 php_fpm_service=$(service:traverse "$SERVICE_NAME":php-fpm) || return 1 - ## We don't want post deploy that is doing the final http initialization. - compose --debug -q --no-init --no-post-deploy --no-pre-deploy \ - --without-relation="$SERVICE_NAME":publish-dir \ - run \ - "${artisan_docker_run_opts[@]}" \ + + launch_docker_compose up -d "${mysql_service}" || return 1 + launch_docker_compose run \ -T --rm -w /opt/apps/"$SERVICE_NAME" \ --entrypoint php \ - -u www-data "$php_fpm_service" artisan "$@" | cat + -u www-data "$php_fpm_service" artisan "$@" - return "${PIPESTATUS[0]}" + return "$?" } dotenv:quote() {