--- id: django-pgmigrate version: "1.6.0" license: BSD-3-Clause license_treatment: permissive maintenance: aging --- # django-pgmigrate — Avoid costly downtime during Postgres migrations. License: permissive · Maintenance: aging · Downloads: 989.6K/mo ## What it is and what it does django-pgmigrate is a Django management command wrapper that solves a common Postgres migration problem: when long-running transactions hold locks, subsequent migrations queue behind them and block all queries on the affected model. The package detects these blocking queries and either terminates them automatically (the default) or prints them for manual review. It also supports setting lock timeouts to cancel migrations that block too long. The package integrates into Django's standard migrate command and requires adding three apps to INSTALLED_APPS. It works with Django 4.2–6.0, Python 3.10–3.14, and Postgres 14–18, making it compatible with modern Django deployments. The two runtime dependencies are django and django-pglock. Use it for: - Automatically terminate blocking queries during production migrations to prevent cascading locks. - Inspect and manually manage blocking activity instead of auto-terminating for workloads requiring careful query control. - Set lock timeouts to fail fast if a migration blocks longer than a configured threshold. - Monitor Postgres process IDs during migrations to correlate blocking activity with application logs. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Prevents migration downtime by detecting and terminating blocking queries during Postgres migrations, or optionally showing them for manual inspection. Yes, if you run Django on Postgres and want to reduce migration downtime. The package is straightforward to install, has no security vulnerabilities, and solves a real operational problem. The aging maintenance status is a minor concern but not a blocker—the codebase is stable and compatible with current versions. Install it if migration locking is a pain point; skip it if you use other databases or have short, non-blocking migrations. ## Install pip install django-pgmigrate uv add django-pgmigrate poetry add django-pgmigrate ## Installing django-pgmigrate Before you install: Low friction install with a pure Python wheel. Maintenance status is aging—last commit was 2025-11-30 and the project has 28 stars—but the package remains actively maintained and compatible with current Django and Python versions. License in practice: BSD-3-Clause is permissive and poses no restriction on commercial or private use. Quickstart: pip install django-pgmigrate # Add to Django INSTALLED_APPS: # 'pgactivity', 'pglock', 'pgmigrate' python manage.py migrate Requires Django 4.2–6.0, Python 3.10–3.14, Postgres 14–18, and Psycopg 2–3. Verify before relying: - Whether automatic query termination is safe for all workload types or if manual inspection is recommended in production. - Performance impact of blocking-query detection during large migration batches. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 989.6K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags postgres migration locking, django migration blocking queries, avoid migration downtime, postgres lock timeout, django database migration safety, django-ops, postgres-migrations [View on SkillFed](https://skillfed.io/packages/django-pgmigrate) · [View on PyPI](https://pypi.org/project/django-pgmigrate/)