skillfed

Flask-Migrate

SQLAlchemy database migrations for Flask applications using Alembic.

flask-migrate v4.1.0 5.7M downloads/30d#2,052 on PyPI2,404
Permissive license MIT Active released

What it is and what it does

Flask-Migrate is a Flask extension that wraps Alembic to manage SQLAlchemy database schema changes. It exposes migration operations through the `flask db` command-line interface, letting you initialize migrations, generate migration scripts from model changes, and apply those changes to your database. The package integrates directly with Flask and Flask-SQLAlchemy, so you initialize it by passing your app and database instance to the Migrate class.

The typical workflow is: run `flask db init` once to set up a migrations folder, then `flask db migrate` each time your models change (which generates a migration script you should review), and `flask db upgrade` to apply pending migrations to your database. Migration scripts are meant to be version-controlled alongside your source code. The package is actively maintained, has no known vulnerabilities, and depends only on Flask, Flask-SQLAlchemy, and alembic.

Use it for:

  • Track and version database schema changes alongside your Flask application code in Git.
  • Automate deployment of schema changes across development, staging, and production environments.
  • Collaborate on database changes in a team by sharing migration scripts through version control.
  • Rollback or replay database changes by running specific migration scripts in sequence.
  • Initialize a new Flask application with an empty database and a migrations folder ready for future changes.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Flask-Migrate handles SQLAlchemy database migrations for Flask applications using Alembic, exposing migration operations as `flask db` command-line commands.

Yes. Flask-Migrate is the standard, actively maintained tool for database migrations in Flask applications. It has low install friction, no security vulnerabilities, permissive licensing, and solves a core problem in Flask development. Install it if you are building a Flask app with SQLAlchemy and need to manage schema changes over time.

Install

flask-migrate on PyPI

pip

pip install flask-migrate

uv

uv add flask-migrate

poetry

poetry add flask-migrate

Installing Flask-Migrate

Before you install

Low friction: pure Python wheel, only three runtime dependencies (Flask, Flask-SQLAlchemy, alembic). Actively maintained with recent releases and a stable repository.

License in practice

MIT license is permissive; you can use, modify, and distribute Flask-Migrate with minimal restrictions, including in commercial applications.

Quickstart

pip install Flask-Migrate

from flask_migrate import Migrate
from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
db = SQLAlchemy(app)
migrate = Migrate(app, db)

# Then run: flask db init, flask db migrate, flask db upgrade

FLASK_APP environment variable must be set for flask db commands to work, as documented in Flask.

Verify before relying

  • Whether Alembic's current detection limitations (e.g., inability to detect indexes) affect your specific schema changes.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 3 — Flask, Flask-SQLAlchemy, alembic
Maintenance actively maintained — 581 days since the last release
Last repo commit
First released
Downloads 5,687,736/month — #2,052 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: Flask_Migrate-4.1.0-py3-none-any.whl

Environment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

flask database migrationssqlalchemy alembic flaskdatabase schema versioningflask db commandmanage database changes flaskalembic integration flaskmigration scripts flask
database-migrationsflask-extensionschema-versioning

More Front-Ends packages