From ca2cccfe4bec49da776a6f63d0f0998b4594c9a2 Mon Sep 17 00:00:00 2001 From: Tessa Alexander Date: Fri, 12 Jan 2024 12:50:27 +0000 Subject: [PATCH] Ensure test database is created and expected migrations hasve been run before importing any new terms --- .github/workflows/check-for-new-mesh-terms.yml | 1 + deploy/fabfile.py | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/check-for-new-mesh-terms.yml b/.github/workflows/check-for-new-mesh-terms.yml index a8e82b2f..5562c097 100644 --- a/.github/workflows/check-for-new-mesh-terms.yml +++ b/.github/workflows/check-for-new-mesh-terms.yml @@ -27,6 +27,7 @@ jobs: - 3306:3306 env: MYSQL_ROOT_PASSWORD: 'ci-db-pswd' + MYSQL_DATABASE: 'ci' steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/deploy/fabfile.py b/deploy/fabfile.py index 24d0640c..d046b7c8 100644 --- a/deploy/fabfile.py +++ b/deploy/fabfile.py @@ -707,6 +707,7 @@ def create_mesh_term_fixtures(env="dev", use_local_mode=False, project_dir=PROJE else: caller(f'wget -O {mesh_term_file_path} https://nlmpubs.nlm.nih.gov/projects/mesh/{year}/meshtrees/mtrees{year}.bin') if _exists_local(mesh_term_file_path, use_local_mode): + caller(f'{venv_dir}bin/python3 manage.py migrate --database=admin --noinput --settings=temmpo.settings.%s' % env) caller(f'{venv_dir}bin/python3 manage.py loaddata {previous_fixture_file} --settings=temmpo.settings.{env}') caller(f'{venv_dir}bin/python3 manage.py import_mesh_terms {mesh_term_file_path} {year} --settings=temmpo.settings.{env}') caller(f'{venv_dir}bin/python3 manage.py dumpdata browser.MeshTerm --indent 4 --output {new_fixture_file_path} --settings=temmpo.settings.{env}')