Skip to content

Databases(Migration) - Flask-Migration

flask-sqlalchemy-title.png

Flask-Migrate is an extension that handles SQLAlchemy database migrations for Flask applications using Alembic. The database operations are made available through the Flask command-line interface or through the Flask-Script extension.

This extension was explain in the previous notes Databases - Flask-SQLAlchemy

  1. Documentation
  2. Github
  3. Pypi

Installation

pip install Flask-Migrate

previous usage

In the previous notes we use this extension to do different things, we did:

Remember this extension work with flask command

Creating migration repository

flask db init
flask-sqlalchemy-title.png

First database migration

flask db migrate -m "users table"
flask-sqlalchemy-title.png

Apply changes to database

flask db upgrade
flask-sqlalchemy-title.png