Recall & Review
beginner
What does the
makemigrations command do in Django?It creates new migration files by detecting changes in your models. These files describe how to update the database schema.
Click to reveal answer
beginner
What is the purpose of the
migrate command in Django?It applies the migration files to the database, updating the database schema to match your models.
Click to reveal answer
beginner
Why do you need to run
makemigrations before migrate?Because
makemigrations creates the instructions for database changes, and migrate actually applies those changes to the database.Click to reveal answer
beginner
If you add a new field to a Django model, what commands should you run to update the database?
First run
python manage.py makemigrations to create migration files, then run python manage.py migrate to apply changes to the database.Click to reveal answer
intermediate
What happens if you run
migrate without running makemigrations after changing models?No new migration files exist, so the database won't update. Your changes won't be applied until you create migrations first.
Click to reveal answer
Which command creates migration files in Django?
✗ Incorrect
makemigrations creates migration files describing database changes.
What does the
migrate command do?✗ Incorrect
migrate applies the migration files to update the database schema.
If you change a model but forget to run
makemigrations, what happens when you run migrate?✗ Incorrect
Without migration files, migrate has nothing to apply.
Which command should you run first after changing models?
✗ Incorrect
You must create migration files first with makemigrations.
What is the main reason Django uses migrations?
✗ Incorrect
Migrations help keep the database structure matching your code models.
Explain the roles of
makemigrations and migrate commands in Django.Think about how code changes become database changes.
You got /4 concepts.
Describe the steps you take after adding a new field to a Django model to update the database.
Focus on the order of commands and their purpose.
You got /4 concepts.