# Django Migration

> Generate and validate approved Django schema migrations exclusively through management commands. Use after approved Model or Configuration changes when makemigrations, migration review, migrate, showmigrations, rollback planning, or migration provenance verification is required. Never use this skill to handwrite, patch, reformat, or add docstrings to migration Python files.

- Skill: `viniciusjsdev/django-migration` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add viniciusjsdev/django-migration`
- Raw SKILL.md: https://api.skillmd.com/api/skills/viniciusjsdev/django-migration/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: viniciusjsdev (https://skillmd.com/u/viniciusjsdev)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/viniciusjsdev/django-migration

---


# Django Migration

Generate reproducible schema changes without manually editing migration code.

## Required Context

Read `AGENTS.md`, `docs/architecture/domain-model.md`, `docs/architecture/backend-implementation-contract.md`, `.codex/references/migration-policy.md`, `.codex/references/model-configuration.md`, and `.codex/checklists/migration-review.md`.

Require an approved implementation contract and identify database ownership, target app, current migration state, and deployment constraints before running commands.

## Workflow

1. Run `python manage.py makemigrations <app_label>` or the project-equivalent command.
2. Review generated operations and confirm the `Generated by Django` provenance header.
3. Run `python manage.py makemigrations --check --dry-run`.
4. Run `python manage.py migrate` in the approved environment.
5. Run `python manage.py showmigrations` and relevant tests.
6. Record commands, generated filenames, results, rollout concerns, and limitations.

## Hard Prohibitions

- Never create, edit, patch, format, rename, or add docstrings to migration Python files.
- Never use an empty migration to introduce handwritten `RunPython` or `RunSQL` logic.
- If generated operations are wrong, change the approved Model/Configuration source and regenerate safely.
- Implement approved data backfills as idempotent management commands with separate verification and rollout steps.
- Never modify a migration already applied in a shared environment.

Finish only when command provenance, pending-change checks, migration application state, and deployment risks are truthfully reported.

