A step-by-step guide to making a FastAPI application production-ready by migrating from SQLite to PostgreSQL and introducing Alembic for database migrations. Covers installing PostgreSQL locally, setting up psycopg3 as the async Python driver, configuring Alembic with an async template, generating and applying migrations, adding new columns to existing tables safely with server defaults, and removing the SQLAlchemy create_all workaround. Also explains the recommended production workflow: generate migrations locally, commit them to version control, and run alembic upgrade head on the server.

47m watch time

Sort: