0
0
Flaskframework~10 mins

Database migration in deployment in Flask - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize Flask-Migrate with your Flask app and SQLAlchemy database.

Flask
from flask_migrate import [1]
migrate = [1](app, db)
Drag options to blanks, or click blank then click option'
AMigrateApp
BMigration
CFlaskMigrate
DMigrate
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect class names like Migration or FlaskMigrate.
Forgetting to pass both app and db to Migrate.
2fill in blank
medium

Complete the command to create a new migration script using Flask-Migrate.

Flask
flask db [1] -m "Initial migration"
Drag options to blanks, or click blank then click option'
Ainit
Bupgrade
Cmigrate
Drevision
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'upgrade' instead of 'migrate' to create migration scripts.
Using 'init' which initializes the migration folder only once.
3fill in blank
hard

Fix the error in the command to apply migrations to the database.

Flask
flask db [1]
Drag options to blanks, or click blank then click option'
Aupgrade
Bdowngrade
Cmigrate
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'migrate' which only creates migration scripts.
Using 'downgrade' which reverts migrations.
4fill in blank
hard

Fill both blanks to import and initialize the Flask app and database for migration.

Flask
from [1] import create_app
from [2] import db
Drag options to blanks, or click blank then click option'
Aapp
Bflask
Cmodels
Dmigrations
Attempts:
3 left
💡 Hint
Common Mistakes
Importing db from flask or migrations modules.
Importing create_app from incorrect modules.
5fill in blank
hard

Fill both blanks to write a command that downgrades the database by one migration step.

Flask
flask db [1] [2]
Drag options to blanks, or click blank then click option'
Aupgrade
Bdowngrade
C-1
Dhead
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'upgrade' instead of 'downgrade'.
Omitting the step count.