Recall & Review
beginner
What is the purpose of Flask-Migrate in a Flask application?
Flask-Migrate helps manage database schema changes over time by creating and applying migrations, so you can update your database structure without losing data.
Click to reveal answer
beginner
Which command initializes Flask-Migrate in your Flask project?
The command
flask db init sets up the migration environment by creating a migrations folder to track changes.Click to reveal answer
beginner
What does the command
flask db migrate -m "message" do?It creates a new migration script that records changes in your database models, with a message describing the update.
Click to reveal answer
beginner
How do you apply the migration scripts to update the database schema?
Use
flask db upgrade to apply the latest migration scripts and update the database structure accordingly.Click to reveal answer
intermediate
Why is it important to use migrations instead of manually changing the database?
Migrations keep track of changes safely, allow easy rollback, and help multiple developers stay in sync without losing data or causing errors.
Click to reveal answer
Which Flask-Migrate command creates the migration folder?
✗ Incorrect
The
flask db init command initializes the migration environment by creating the migrations folder.What does
flask db upgrade do?✗ Incorrect
flask db upgrade applies the migration scripts to update the database schema.When should you run
flask db migrate?✗ Incorrect
You run
flask db migrate after changing your models to create a migration script reflecting those changes.Which file or folder does Flask-Migrate create to track migrations?
✗ Incorrect
Flask-Migrate creates a
migrations folder to store migration scripts and track changes.What is a key benefit of using Flask-Migrate in a team project?
✗ Incorrect
Flask-Migrate helps teams keep database schema changes synchronized and safe across different environments.
Explain the typical workflow for managing database changes using Flask-Migrate.
Think about the commands you run step-by-step after changing your models.
You got /4 concepts.
Why is it better to use Flask-Migrate instead of manually editing the database schema?
Consider safety and teamwork benefits.
You got /4 concepts.