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 head
command 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 head
command to perform migrations
- Start
pipenv run uvicorn main:app --host 0.0.0.0 --port 80 --reload
file. - 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.txt
command - Run
pytest
command
- Add/Remove import model in
src\infrastructure\postgres\metadata_agregation.py
file - Run
alembic revision --autogenerate -m "my_migration_name"
command
- Run
alembic upgrade head
command - Alternative, you can upgrate by steps with
alembic upgrade +1
- Run
alembic downgrade -1
command
- v0.0.1 - First Release