This document describes how to set up the PostgreSQL database and use Alembic for managing schema migrations.
Environment variables are defined in a .env file at the project root:
DATABASE_URL=postgresql+psycopg2://soundbird:soundbirdpass@localhost:5432/soundbird_db- Provision the PostgreSQL database (you can use Docker):
docker run --name soundbird-db -e POSTGRES_USER=soundbird \
-e POSTGRES_PASSWORD=soundbirdpass -e POSTGRES_DB=soundbird_db \
-p 5432:5432 -d postgres:14
- Install Alembic:
pip install alembic python-dotenv
- Initialize Alembic:
alembic init alembic
Use these commands every time you update your SQLAlchemy models:
alembic revision --autogenerate -m "Describe your change"
alembic upgrade head
alembic downgrade -1