django-test-migrations
Test django schema and data migrations, including ordering
Decision gist · record as of 2026-08-14
Yes. If you maintain Django projects with non-trivial migrations (data transformations, schema changes, rollbacks), this package is worth installing. It has low install friction, active maintenance, no known vulnerabilities, a permissive license, and solves a real problem—catching migration bugs before production. Start with it if you're already using pytest or unittest.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later and a Django project with configured migrations (3.2, 4.1, 4.2, 5.0 officially supported; other versions likely work).
- Low friction: pure Python wheel with a single runtime dependency (typing-extensions).
- Active maintenance with a release 9 days ago and 573 repository stars.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
last release 2026-08-05 (9 days) · last repo commit 2026-08-14 · 573 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 658,190 downloads/mo, #5,470 on PyPI
Alternatives
Verify before relying
pip install django-test-migrations
from django_test_migrations.migrator import Migrator
migrator = Migrator(database='default')
old_state = migrator.apply_initial_migration(('app_name', '0001_initial'))
new_state = migrator.apply_tested_migration(('app_name', '0002_next'))
migrator.reset()- Whether all advertised Django versions (3.2–6.1) are equally well-tested or if some are less stable than others.
- Performance characteristics when testing large numbers of migrations or complex schema changes.
What it is and what it does
django-test-migrations is a testing library that lets you write automated tests for Django database migrations. It provides a Migrator class to apply migrations in isolation, inspect database state before and after, and verify that data is preserved correctly. It also validates migration ordering and dependencies, and detects rollback issues. The library integrates with pytest (via fixtures and markers) and unittest (via a base test case), and supports factory_boy for creating test data.
You use it by applying an initial migration to set up a before-state, then applying the migration you want to test, then asserting on the resulting model structure and data. This catches bugs in complex schema or data transformations that unit tests alone won't catch. It's particularly useful when migrations modify existing data, add constraints, or change relationships—situations where silent data corruption is a real risk.
Use it for
- Verify that a data migration correctly transforms existing records without loss or corruption.
- Test that a schema migration can be safely rolled back and re-applied without errors.
- Validate that all migrations in an app are in the correct order with correct dependencies.
- Ensure a new field migration applies the correct default values to existing rows.
- Confirm that a migration removing a column doesn't break dependent migrations.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
If you maintain Django projects with non-trivial migrations (data transformations, schema changes, rollbacks), this package is worth installing. It has low install friction, active maintenance, no known vulnerabilities, a permissive license, and solves a real problem—catching migration bugs before production. Start with it if you're already using pytest or unittest.
Install
django-test-migrations on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (typing-extensions). Active maintenance with a release 9 days ago and 573 repository stars.
Requires Python 3.10 or later and a Django project with configured migrations (3.2, 4.1, 4.2, 5.0 officially supported; other versions likely work).
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
pip install django-test-migrations
from django_test_migrations.migrator import Migrator
migrator = Migrator(database='default')
old_state = migrator.apply_initial_migration(('app_name', '0001_initial'))
new_state = migrator.apply_tested_migration(('app_name', '0002_next'))
migrator.reset()
Verify before relying
- Whether all advertised Django versions (3.2–6.1) are equally well-tested or if some are less stable than others.
- Performance characteristics when testing large numbers of migrations or complex schema changes.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping-extensions |
| Maintenance | Actively maintained 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 658,190 / month, #5,470 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: DjangoFramework :: Django :: 3.2Framework :: Django :: 4.1Framework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Framework :: Django :: 6.1Intended Audience :: DevelopersOperating System :: OS IndependentTopic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python Modules |
Evidence: django_test_migrations-1.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django migration testing”
- django-test-migrationsTests Django schema and data migrations, including forward/backward…
- django-linear-migrationsEnforces linear migration history in Django projects by tracking the…
- django-pgmigratePrevents migration downtime by detecting and terminating blocking…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also django-migration-linter · pytest-alembic · peewee-migrate · django-linear-migrations · django-pg-zero-downtime-migrations · django-safemigrate · sqlalchemy-migrate · migra · django-syzygy