From the docs:
Alembic is a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python.
It allows us to generate database schemas from Python SQLAlchemy code, found in each
models.py
file.
Here are some of the most commonly used commands you might need.
alembic revision --autogenerate -m "my_revision_name"
Make sure to review the generated script in alembic/versions
and make adjustments if needed.
alembic upgrade head
alembic downgrade -1
alembic downgrade base
For more examples, see the official Alembic tutorial.