django-pg-migration-tools is a Python library that provides a set of specialized Django migration operations designed to make database schema changes safer and more scalable on PostgreSQL. It includes tools for idempotent model creation, concurrent index and constraint management, function migration, and concurrent column alterations, aiming to minimize downtime and avoid common locking issues during deployments. The current version is 0.1.26, and it typically sees releases for new features or bug fixes rather than a fixed cadence.
pip install django-pg-migration-toolsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `AddIndexConcurrently` within a Django migration. Note that for any 'CONCURRENTLY' operation, the migration must set `atomic = False`. This example assumes you have a Django project and an app named `your_app_name` with a model `yourmodelname` and a `field_name`.
Add `atomic = False` as a class attribute to your `migrations.Migration` class: `class Migration(migrations.Migration): atomic = False`.
Add `'django_pg_migration_tools.checks.PostgreSQLCheck'` to your Django `settings.py` `SILENCED_SYSTEM_CHECKS` or explicitly run it during development/testing. Ensure you understand its warnings.
Consult the project's GitHub releases page or `pyproject.toml`/`setup.py` for specific changes before upgrading. Pin your dependency versions to prevent automatic updates.