SQLAlchemy database migrations for Flask applications using Alembic
Flask-Migrate 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. Installation Install Flask-Migrate with pip: pip install Flask-Migrate Example This is an example application that handles database migrations through Flask-Migrate: from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate app = Flask(__name__) app.config[‘SQLALCHEMY_DATABASE_URI’] = ‘sqlite:///app.db’ db = SQLAlchemy(app) migrate = Migrate(app, db) class User(db.Model): id = db.Column(db.Integer, primary_key=True) name […]
Read more