マイグレーションは、モデルに加えた変更(フィールドの追加、モデルの作成)をデータベーススキーマに反映させるDjangoの方法です。これらはバージョン管理されており、自動生成されるデータベース変更ファイルです。Pythonでモデルを変更すると、マイグレーションがデータベースを同期状態に保ちます。
2段階のワークフロー
# 1. you change a model in models.py (e.g. add a field)...
# 2. generate a migration file describing the change
python manage.py makemigrations
# → creates migrations/0002_article_views.py (the change, as Python)
# 3. apply the migration to the database
python manage.py migrate
