Skip to content
Learn Netverks

Lesson

Step 20/36 56% through track

migrations-intro

Migrations introduction

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
intermediate

This lesson

An orientation to the Django track—how the server playground works, core vocabulary, and what you will practice next.

You need a clear map of the Django track so MVT, the ORM, and project layout do not feel like magic.

You will apply Migrations introduction in contexts like: SaaS dashboards, CMS-style products, internal tools, and APIs paired with React or mobile clients.

Write Python 3 in the editor and click Run on server—the dev runner executes your script; Django framework lessons also use local startproject for full MVT (LEARNING_RUNNER_ENABLED=true). Also read the interview prep blocks.

After HTML fundamentals and basic programming concepts—before or alongside SQL.

Migrations are version-controlled schema changes—like Git for your database structure. Django generates them from model changes and applies them with migrate.

Workflow

  1. Edit models.py
  2. python manage.py makemigrations — creates migration files
  3. python manage.py migrate — applies to database

Best practices

  • Commit migration files to git—teams must share the same history
  • Review auto-generated migrations before deploying
  • Never edit applied migrations in production—create new ones
  • Data migrations use RunPython for backfills

Important interview questions and answers

  1. Q: makemigrations vs migrate?
    A: makemigrations writes Python migration files from model diffs; migrate executes them against the DB.
  2. Q: Squashing migrations?
    A: Combines many migrations into one for cleaner history in long projects—plan carefully.
  3. Q: Zero-downtime deploys?
    A: Add nullable columns first, backfill, then enforce NOT NULL in a follow-up migration.

Self-check

  1. Which command creates migration files?
  2. Why commit migrations to version control?

Tip: Run makemigrations after every model change and commit the files—never "fix" production by hand-editing tables without a migration.

Interview prep

makemigrations vs migrate?

makemigrations writes migration files from model changes; migrate applies them to the database schema.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • makemigrations vs migrate?
  • Squash when?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump