diff --git a/.travis.yml b/.travis.yml index c37d3e24..c1042380 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ before_script: script: - psql -c 'create database mpwo_test;' -U postgres - - docker-compose -f docker-compose-ci.yml run mpwo-api flask db upgrade + - docker-compose -f docker-compose-ci.yml run mpwo-api flask db upgrade --directory mpwo_api/migrations - sh test.sh after_script: diff --git a/Makefile b/Makefile index a7dbcda5..bc0c4536 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ make-p: init-db: $(FLASK) drop_db - $(FLASK) db upgrade + $(FLASK) db upgrade --directory $(MIGRATIONS) $(FLASK) init_data install: install-client install-python @@ -23,7 +23,7 @@ install-python: lint-all: lint-python lint-react lint-python: - $(PYTEST) --flake8 --isort -m "flake8 or isort" mpwo_api + $(PYTEST) --flake8 --isort -m "flake8 or isort" mpwo_api --ignore=mpwo_api/migrations lint-react: $(NPM) lint @@ -47,4 +47,4 @@ test-python: $(FLASK) test_local upgrade-db: - $(FLASK) db upgrade + $(FLASK) db upgrade --directory $(MIGRATIONS) diff --git a/Makefile.config b/Makefile.config index 77f7b0f7..218443cc 100644 --- a/Makefile.config +++ b/Makefile.config @@ -8,6 +8,7 @@ export TEST_URL = http://$(HOST):$(CLIENT_PORT) export REQUIREMENTS = $(PWD)/mpwo_api/requirements.txt export DATABASE_URL = postgres://mpwo:mpwo@$(HOST):5432/mpwo export DATABASE_TEST_URL = postgres://mpwo:mpwo@$(HOST):5432/mpwo_test +export MIGRATIONS = $(PWD)/mpwo_api/migrations # Python env PYTHON_VERSION ?= python diff --git a/mpwo_api/Dockerfile b/mpwo_api/Dockerfile index a400ba32..b35f11f2 100644 --- a/mpwo_api/Dockerfile +++ b/mpwo_api/Dockerfile @@ -14,7 +14,6 @@ RUN pip install -r mpwo_api/requirements.txt # add app COPY . /usr/src/app -COPY ../migrations /usr/src/app # run server CMD flask run --with-threads -h 0.0.0.0 diff --git a/migrations/README b/mpwo_api/migrations/README similarity index 100% rename from migrations/README rename to mpwo_api/migrations/README diff --git a/migrations/alembic.ini b/mpwo_api/migrations/alembic.ini similarity index 100% rename from migrations/alembic.ini rename to mpwo_api/migrations/alembic.ini diff --git a/migrations/env.py b/mpwo_api/migrations/env.py similarity index 99% rename from migrations/env.py rename to mpwo_api/migrations/env.py index 23663ff2..66cf1b56 100755 --- a/migrations/env.py +++ b/mpwo_api/migrations/env.py @@ -81,6 +81,7 @@ def run_migrations_online(): finally: connection.close() + if context.is_offline_mode(): run_migrations_offline() else: diff --git a/migrations/script.py.mako b/mpwo_api/migrations/script.py.mako similarity index 100% rename from migrations/script.py.mako rename to mpwo_api/migrations/script.py.mako diff --git a/migrations/versions/9741fc7834da_.py b/mpwo_api/migrations/versions/9741fc7834da_.py similarity index 100% rename from migrations/versions/9741fc7834da_.py rename to mpwo_api/migrations/versions/9741fc7834da_.py