-
$ brew install postgresql -
$ pip install psycopg2 -
Check with
$ which pg_config
-
On your terminal, run
$ alembic init alembic- it creates a new directory alembic and a new file alembic.ini
-
Go to
alembic.initand add the database url- line 58:
sqlalchemy.url = ADD DATABASE URL HERE
- line 58:
-
Go to
alembic/env.pyand add your models
from models import Base
target_metadata = Base.metadata- Create alembic revision
$ alembic revision --autogenerate -m "First revision"$ pipenv run alembic upgrade head