How do you manage database migrations in Flask?
Instruction: Describe the tools and processes you use for handling database migrations in a Flask application.
Context: This question evaluates the candidate's experience with database management and migrations within Flask, highlighting their familiarity with tools like Flask-Migrate.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Flask itself does not manage database migrations. For SQLAlchemy projects, Flask-Migrate integrates Alembic commands with the application. Initialize the existing migration setup and keep its revision files in source control with the corresponding model changes.
Generate a candidate revision with flask db migrate, review it, then apply the reviewed revision with flask db upgrade. Generation does not apply the change...