Flask demo app for working out issues in isolation.
This demo relates to setting up tests to automatically rollback database changes.
The current problem of this demo is that database changes are not rolled back between each test.
The tests assume a flaskdemo-test
PostgreSQL database.
Username, password, host and port is setup in .env
file.
Populate .env
, refer to .env.example
.
https://alembic.sqlalchemy.org/en/latest/autogenerate.html
-
Modify
models.py
. -
Generate migration:
flask db revision "Initial migration" flask db revision "Added account table"
-
Check in the generated migration file and update as needed.
-
Run the migration:
flask db upgrade
flask --app app run --debug --port 5333
pytest