Skip to content

Add Django migration lint command (#2451)#2779

Open
Tarekchehahde wants to merge 1 commit into
IFRCGo:developfrom
Tarekchehahde:feat/2451-migration-lint
Open

Add Django migration lint command (#2451)#2779
Tarekchehahde wants to merge 1 commit into
IFRCGo:developfrom
Tarekchehahde:feat/2451-migration-lint

Conversation

@Tarekchehahde

Copy link
Copy Markdown

Summary

  • Adds api/migration_lint.py to validate migration filenames, in-repo dependency targets, and duplicate migration numbers without a merge migration
  • Adds python manage.py lint_migrations management command
  • Wires a local pre-commit hook when migration files are staged
  • Adds unit tests runnable without full Django settings (python -m unittest api.tests.test_migration_lint)

Closes #2451

Test plan

  • uv run python -m unittest api.tests.test_migration_lint -v — 3 tests pass
  • Standalone lint on repo root — 0 errors on existing migrations
  • python manage.py lint_migrations in docker-compose dev environment (requires API_FQDN etc.)

Made with Cursor

Adds a migration linter and pre-commit hook to catch invalid filenames,
missing in-repo dependencies, and duplicate migration numbers without merges.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Linting for Migration Conflicts

1 participant