Add database migrations
- use Alembic to migrate the PostgreSQL database
+ create initial migration script to set up the database,
as an alternative to db.Base.metadata.create_all()
+ integrate Alembic into the test suite; the db_engine fixture
now has two modes:
* create the latest version of tables all at once
* invoke `alembic upgrade head`
=> the "e2e" tests are all run twice, once in each mode; this
ensures that the migration scripts re-create the same database
schema as db.Base.metadata.create_all() would
* in both modes, a temporary PostgreSQL schema is used to create the
tables in
=> could now run "e2e" tests against production database and still
have isolation
- make the configuration module public (to be used by Alembic)
- adjust linting rules for Alembic
This commit is contained in:
parent
fdcc93a1ea
commit
a16c260543
14 changed files with 1104 additions and 35 deletions
|
|
@ -27,6 +27,7 @@ repository = "https://github.com/webartifex/urban-meal-delivery"
|
|||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
|
||||
alembic = "^1.4.2"
|
||||
click = "^7.1.2"
|
||||
psycopg2 = "^2.8.5" # adapter for PostgreSQL
|
||||
python-dotenv = "^0.14.0"
|
||||
|
|
@ -56,6 +57,7 @@ wemake-python-styleguide = "^0.14.1" # flake8 plug-in
|
|||
packaging = "^20.4" # used to test the packaged version
|
||||
pytest = "^6.0.1"
|
||||
pytest-cov = "^2.10.0"
|
||||
pytest-env = "^0.6.2"
|
||||
xdoctest = { version="^0.13.0", extras=["optional"] }
|
||||
|
||||
# Documentation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue