From a2f98fd1cf6b0634f4e9776400e872f30009a49c 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 | 10 +++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/opensem/hooks/pre_deploy b/opensem/hooks/pre_deploy index 11358bb..ebac953 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..3d24286 100644 --- a/opensem/lib/common +++ b/opensem/lib/common @@ -111,16 +111,12 @@ artisan() { export COMPOSE_IGNORE_ORPHANS=true 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 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() {