Flask-Migrate

SQLAlchemy database migrations for Flask applications using Alembic

What is Flask-Migrate?

SQLAlchemy database migrations for Flask applications using Alembic

Overview of Flask-Migrate

What it is

Flask-Migrate is an extension that handles SQLAlchemy database migrations for Flask applications using Alembic. The database operations are provided as command-line arguments under the flask db command.

Key features

  • Provides database migration support for Flask applications using SQLAlchemy and Alembic.
  • Offers command-line operations via the flask db command.
  • Supports initializing a migration environment with flask db init.
  • Allows generating migration scripts automatically with flask db migrate.
  • Enables applying migrations to the database with flask db upgrade.
  • Migration scripts can be reviewed and edited before application.
  • The migrations folder is intended to be added to version control.

Use cases

Flask-Migrate is used in Flask applications that require SQLAlchemy database schema changes over time. It is suitable for development workflows where database models evolve, and for deploying updates across different environments by synchronizing migration scripts from version control.

Getting started

Install Flask-Migrate with pip:pip install Flask-MigrateAfter setting up a Flask application with SQLAlchemy and initializing the Migrate object, run the following commands to manage migrations:flask db initflask db migrateflask db upgradeNote that the FLASK_APP environment variable must be set according to the Flask documentation for these commands to work.

License and pricing

Flask-Migrate is open source and licensed under the MIT license.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/miguelgrinbergflask-migrate.svg)](https://yunodb.com/tools/miguelgrinbergflask-migrate?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/miguelgrinbergflask-migrate?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/miguelgrinbergflask-migrate.svg" alt="Featured on YunoDB" height="20"></a>