moving alembic script directory

This commit is contained in:
SamR1 2018-01-20 20:05:41 +01:00
parent cd1010e339
commit 3fb7f05fd5
9 changed files with 6 additions and 5 deletions

View File

@ -41,7 +41,7 @@ before_script:
script: script:
- psql -c 'create database mpwo_test;' -U postgres - 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 - sh test.sh
after_script: after_script:

View File

@ -8,7 +8,7 @@ make-p:
init-db: init-db:
$(FLASK) drop_db $(FLASK) drop_db
$(FLASK) db upgrade $(FLASK) db upgrade --directory $(MIGRATIONS)
$(FLASK) init_data $(FLASK) init_data
install: install-client install-python install: install-client install-python
@ -23,7 +23,7 @@ install-python:
lint-all: lint-python lint-react lint-all: lint-python lint-react
lint-python: 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: lint-react:
$(NPM) lint $(NPM) lint
@ -47,4 +47,4 @@ test-python:
$(FLASK) test_local $(FLASK) test_local
upgrade-db: upgrade-db:
$(FLASK) db upgrade $(FLASK) db upgrade --directory $(MIGRATIONS)

View File

@ -8,6 +8,7 @@ export TEST_URL = http://$(HOST):$(CLIENT_PORT)
export REQUIREMENTS = $(PWD)/mpwo_api/requirements.txt export REQUIREMENTS = $(PWD)/mpwo_api/requirements.txt
export DATABASE_URL = postgres://mpwo:mpwo@$(HOST):5432/mpwo export DATABASE_URL = postgres://mpwo:mpwo@$(HOST):5432/mpwo
export DATABASE_TEST_URL = postgres://mpwo:mpwo@$(HOST):5432/mpwo_test export DATABASE_TEST_URL = postgres://mpwo:mpwo@$(HOST):5432/mpwo_test
export MIGRATIONS = $(PWD)/mpwo_api/migrations
# Python env # Python env
PYTHON_VERSION ?= python PYTHON_VERSION ?= python

View File

@ -14,7 +14,6 @@ RUN pip install -r mpwo_api/requirements.txt
# add app # add app
COPY . /usr/src/app COPY . /usr/src/app
COPY ../migrations /usr/src/app
# run server # run server
CMD flask run --with-threads -h 0.0.0.0 CMD flask run --with-threads -h 0.0.0.0

View File

@ -81,6 +81,7 @@ def run_migrations_online():
finally: finally:
connection.close() connection.close()
if context.is_offline_mode(): if context.is_offline_mode():
run_migrations_offline() run_migrations_offline()
else: else: