Django Run Migrations
Developmentdjango-run-migrationsDjango Run Migrations is an Agent Skill for development published in the fossasia/eventyay repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Steps for generating and applying Django migrations
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/fossasia/eventyay/blob/HEAD/.agents/skills/django-run-migrations/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/django-run-migrations, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
When to use
Use this skill continuously after modifying any models.py schema logic to apply the changes to the database.
Steps
- Navigate to the app context:
cd app/ - Generate the required migration definitions by running:
python manage.py makemigrations - Execute and apply the generated migration file to the DB safely:
python manage.py migrate
Validation
- Verify that the terminal explicitly outputs "Applying..." states and succeeds without tracebacks.
- Quickly review the auto-generated
.pymigration output to ensure logical alignment with your model edits.
Gotchas
- Do not manually edit auto-generated migration files unless executing an explicitly necessary, advanced requirement (i.e. complex data backfill operations). Never rewrite migrations that have already been applied to a shared or production database; instead, create a new migration for any additional schema changes.
Tips
If your changes in Django models don't cause a change in the actual database schema, you don't need to create a migration at all.
Typical changes that do not affect the DB schema include:
choicesverbose_namehelp_text
In these cases:
- Do not run
makemigrationsjust to capture these metadata-only changes. - Do not edit existing migration files that may already have been applied. The only safe exception is in a narrowly scoped, pre-merge situation where a migration has never been applied to any shared or production database and you are cleaning up that pending migration before it lands. Otherwise, always create a new migration to capture real schema changes.