--- id: flask-migrate version: "4.1.0" license: MIT license_treatment: permissive maintenance: active --- # Flask-Migrate — SQLAlchemy database migrations for Flask applications using Alembic. License: permissive · Maintenance: active · Downloads: 5.7M/mo ## 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 above — 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 pip install flask-migrate uv add flask-migrate 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_current - Install friction: low - Maintenance: active - Downloads: 5.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags flask database migrations, sqlalchemy alembic flask, database schema versioning, flask db command, manage database changes flask, alembic integration flask, migration scripts flask, database-migrations, flask-extension, schema-versioning [View on SkillFed](https://skillfed.io/packages/flask-migrate) · [View on PyPI](https://pypi.org/project/flask-migrate/)