weco-migration-safety

Validates Django model and migration changes for safe deployment on fresh and existing databases.

Updated Jun 13, 2026
One-click install
npx skills add https://github.com/malinovskiy-makar/qls --skill weco-migration-safety-malinovskiy-makar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: weco-migration-safety
Source: https://github.com/malinovskiy-makar/qls/tree/main/.claude/skills/weco-migration-safety
Command: npx skills add https://github.com/malinovskiy-makar/qls --skill weco-migration-safety-malinovskiy-makar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Django schema changes can silently break deployments: duplicate migration numbers, diverged migration graphs between branches, models out of sync with migrations, and irreversible data migrations all surface only at deploy time. This Skill enforces a verification checklist before any schema change ships. ## Core Features & Use Cases - Migration graph integrity check: Detects duplicate migration numbers, broken dependency chains, and multiple leaf nodes using showmigrations. - Model-migration consistency: Runs makemigrations --check --dry-run to confirm no pending schema changes were forgotten. - Deployment path verification: Tests both fresh-database deployment and upgrade on a copy of an existing database, including PostgreSQL-specific issues like stale sequences. - Use Case: After merging a branch that touched models.py and added migration files, run this check to confirm the graph is intact, migrations apply cleanly from scratch, and each migration can be rolled back. ## Quick Start Check whether my Django model and migration changes are safe to deploy on a clean database and on a copy of the existing one.

Frequently Asked Questions about weco-migration-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check Django migrations are safe before deploying?

Run showmigrations to verify the graph has no duplicate numbers or broken chains, then makemigrations --check --dry-run to confirm models match migrations. Finally test migrate on a clean database and on a copy of the existing database, and verify each migration can roll back.

How to verify Django models and migrations are in sync?

Run manage.py makemigrations --check --dry-run. It must report No changes detected; any proposed migration means either a migration was never generated or the branch is missing migration files that exist elsewhere.

Why is migrate --fake dangerous in Django?

migrate --fake marks migrations as applied without running them, so the database state and migration graph silently diverge. The discrepancy typically surfaces later on another machine, which is why it requires explicit written owner approval.

Can I run makemigrations when some migration files are missing?

No. Django does not know about the missing numbers and will generate a new migration under an already-used number, creating two different migrations with the same number that can never be reconciled.

Why do Django migrations work on SQLite but fail on PostgreSQL?

Some errors only appear on PostgreSQL, such as stale sequences after bulk inserts with explicit ids and constraint differences. Test migrations on an empty PostgreSQL instance and run sqlsequencereset after bulk data loads.

When should a Django data migration be reversible?

Every RunPython migration should define a reverse function or explicitly use migrations.RunPython.noop with a comment explaining why rollback is unnecessary. Large data migrations should also flag expected deploy downtime.