From 407412f89f0431dd3cd0522d681ca7bb78eed4b6 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Wed, 12 Jul 2023 16:32:44 -0400 Subject: [PATCH] feat: Use new edx-platform make migrate command. Replaces some of the manual calls to `manage.py migrate` with `make migrate` for more consistency with other IDAs. https://github.com/openedx/devstack/issues/1085 --- Makefile | 6 ++---- provision-lms.sh | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3bec786162..2cab1afed2 100644 --- a/Makefile +++ b/Makefile @@ -255,12 +255,10 @@ $(foreach db_service,$(DB_SERVICES_LIST),\ dev.migrate: | $(_db_migration_targets) ## Run migrations for applicable default services. dev.migrate.cms: - docker-compose exec -T -u root cms bash -e -c '/edx/app/edxapp/venvs/edxapp/bin/python manage.py cms showmigrations --database default --traceback --pythonpath=. --settings devstack_docker' - docker-compose exec -T -u root cms bash -e -c '/edx/app/edxapp/venvs/edxapp/bin/python manage.py cms migrate --database default --noinput --traceback --pythonpath=. --settings devstack_docker' + docker-compose exec cms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && make migrate' dev.migrate.lms: - docker-compose exec -T -u root lms bash -e -c '/edx/app/edxapp/venvs/edxapp/bin/python manage.py lms showmigrations --database default --traceback --pythonpath=. --settings devstack_docker' - docker-compose exec -T -u root lms bash -e -c '/edx/app/edxapp/venvs/edxapp/bin/python manage.py lms migrate --database default --noinput --traceback --pythonpath=. --settings devstack_docker' + docker-compose exec lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && make migrate' dev.migrate.%: ## Run migrations on a service. docker-compose exec $* bash -c 'source /edx/app/$*/$*_env && cd /edx/app/$*/$*/ && make migrate' diff --git a/provision-lms.sh b/provision-lms.sh index 1a2b64a71a..c7127c892e 100755 --- a/provision-lms.sh +++ b/provision-lms.sh @@ -26,13 +26,12 @@ for app in "${apps[@]}"; do done # Run edxapp migrations first since they are needed for the service users and OAuth clients -docker-compose exec -T lms bash -e -c 'source /edx/app/edxapp/edxapp_env && /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py lms showmigrations --database default --traceback --pythonpath=. --settings devstack_docker' -docker-compose exec -T lms bash -e -c 'source /edx/app/edxapp/edxapp_env && /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py lms migrate --database default --noinput --traceback --pythonpath=. --settings devstack_docker' +# Make migrate runs migrations for both lms and cms. +docker-compose exec -T lms bash -e -c 'source /edx/app/edxapp/edxapp_env && make migrate' + docker-compose exec -T lms bash -e -c 'source /edx/app/edxapp/edxapp_env && /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py lms showmigrations --database student_module_history --traceback --pythonpath=. --settings devstack_docker' docker-compose exec -T lms bash -e -c 'source /edx/app/edxapp/edxapp_env && /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py lms migrate --database student_module_history --noinput --traceback --pythonpath=. --settings devstack_docker' -docker-compose exec -T cms bash -e -c 'source /edx/app/edxapp/edxapp_env && /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py cms showmigrations --database default --traceback --pythonpath=. --settings devstack_docker' -docker-compose exec -T cms bash -e -c 'source /edx/app/edxapp/edxapp_env && /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py cms migrate --database default --noinput --traceback --pythonpath=. --settings devstack_docker' docker-compose exec -T cms bash -e -c 'source /edx/app/edxapp/edxapp_env && /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py cms showmigrations --database student_module_history --traceback --pythonpath=. --settings devstack_docker' docker-compose exec -T cms bash -e -c 'source /edx/app/edxapp/edxapp_env && /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py cms migrate --database student_module_history --noinput --traceback --pythonpath=. --settings devstack_docker'