0
0
Flaskframework~5 mins

Database migration in deployment in Flask - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AFlask-Mail
BFlask-Login
CFlask-WTF
DFlask-Migrate
What command creates a new migration script after model changes?
Aflask db migrate -m "message"
Bflask db init
Cflask run
Dflask db upgrade
What does flask db upgrade do?
ACreates a new migration script
BApplies migration scripts to update the database
CRuns the Flask app
DInitializes the migration environment
Why are database migrations important during deployment?
ATo update database schema without losing data
BTo change the app's UI
CTo restart the server
DTo clear the database
Which tool does Flask-Migrate use internally?
ASQLAlchemy
BPip
CAlembic
DJinja2
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.