- ensure poetry is installed in your system
- run
poetry init
in root of project - install python packages with
poetry add {packageName}
- run server with
uvicorn main:app --reload
- run
poetry add alembic
- run
alembic init alembic
- run
alembic revision --autogenerate
to generate migration file - run
alembic upgrade head
to run migration to postgres db - update migration file that contains enum:
op.add_column('users', sa.Column('role', sa.Enum('teacher', 'student', name='role'), nullable=True))
- take note of sqlalchemy Enums in migration file
- check docs for syntax for versions >= 1.4 to use async
- need to use async compatible driver (asyncpg for postgres)