Recall & Review
beginner
What is a database migration in the context of Flask deployment?
A database migration is a way to update the database schema (structure) safely when the application changes, without losing existing data.
Click to reveal answer
beginner
Which Flask extension is commonly used for database migrations?
Flask-Migrate is the common extension that helps manage database migrations using Alembic under the hood.
Click to reveal answer
beginner
What command do you run to create a new migration script after changing your models?
You run
flask db migrate -m "message" to generate a migration script reflecting model changes.Click to reveal answer
beginner
Why should you run
flask db upgrade during deployment?Running
flask db upgrade applies the migration scripts to update the database schema to the latest version.Click to reveal answer
intermediate
What is the role of Alembic in Flask database migrations?
Alembic is the tool that Flask-Migrate uses to track and apply database schema changes safely.
Click to reveal answer
Which Flask extension helps manage database migrations?
✗ Incorrect
Flask-Migrate is designed to handle database migrations in Flask apps.
What command creates a new migration script after model changes?
✗ Incorrect
The 'flask db migrate' command generates migration scripts based on model changes.
What does
flask db upgrade do?✗ Incorrect
It applies the migration scripts to update the database schema.
Why are database migrations important during deployment?
✗ Incorrect
Migrations update the database structure safely without data loss.
Which tool does Flask-Migrate use internally?
✗ Incorrect
Alembic is the migration tool Flask-Migrate uses to track schema changes.
Explain the steps to perform a database migration in a Flask deployment.
Think about how you update the database schema safely after changing your code.
You got /5 concepts.
Why is it important to use migrations instead of manually changing the database during deployment?
Consider what could go wrong if you change the database by hand.
You got /4 concepts.