This repository aims to provide template to use alembic on fastapi
- If necessary, set environment variables like
docker compose up -d - Run
docker exec api python3 -m alembic upgrade headcommand to perform migrations - Access the docs from
127.0.0.1:8000/docs
- You need a postgres server running
- Install pipenv:
pip install pipenv - Install requirements:
pipenv install --dev - If necessary, set environment variables like
app/settings/environment.py - Run
alembic upgrade headcommand to perform migrations
- Start
pipenv run uvicorn main:app --host 0.0.0.0 --port 80 --reloadfile. - It runs an uvicorn server at
127.0.0.1:8000 - Access the docs from
127.0.0.1:8000/docs
To run the tests just follow the steps:
- Run
pip install -r requirements/test.txtcommand - Run
pytestcommand
- Add/Remove import model in
src\infrastructure\postgres\metadata_agregation.pyfile - Run
alembic revision --autogenerate -m "my_migration_name"command
- Run
alembic upgrade headcommand - Alternative, you can upgrate by steps with
alembic upgrade +1
- Run
alembic downgrade -1command
- v0.0.1 - First Release