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 dbcommand. - 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
migrationsfolder 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.