django-pg-migration-tools
Tools for making Django migrations safer and more scalable.
Decision gist · record as of 2026-08-14
Yes, if you run Django on PostgreSQL and perform schema migrations on live databases. The package directly addresses a real production pain point—long-running migrations that lock tables—and is actively maintained with no external dependencies. The alpha status reflects early releases, but the core operations are straightforward and well-documented. Install if you need safer schema changes; skip if you use a different database backend or have no production migration concerns.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django and PostgreSQL; operations are PostgreSQL-specific and will not work with other database backends.
- Low friction installation with no runtime dependencies.
- Actively maintained as of 2026-02-27 with recent releases.
License · maintenance · safety
permissive license (permissive) — BSD 3-Clause License permits commercial and private use with minimal restrictions; you may modify and distribute freely provided you retain copyright notices and disclaimers.
last release 2026-02-27 (168 days) · last repo commit 2026-02-27 · 61 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 76,180 downloads/mo, #14,650 on PyPI
Alternatives
Verify before relying
pip install django-pg-migration-tools
from django_pg_migration_tools.operations import SaferAddIndexConcurrently
class Migration(migrations.Migration):
operations = [
SaferAddIndexConcurrently(
model_name='mymodel',
index=models.Index(fields=['field_name'])
)
]- Minimum Django version requirement not specified in fact sheet.
- Whether all operations are backward-compatible with existing migration files.
- Performance impact of safer operations compared to standard Django migrations.
What it is and what it does
django-pg-migration-tools is a Django package that wraps PostgreSQL-specific migration operations to make schema changes safer in production environments. It provides drop-in replacements for standard Django migration operations—adding/removing constraints, indexes, and foreign keys—that use PostgreSQL's non-blocking techniques (like concurrent index creation) and timeout controls to prevent migrations from locking tables and blocking application traffic.
The package includes management commands to run migrations with configurable statement and lock timeouts, and context managers to apply timeouts to arbitrary database operations. It's designed for teams running Django on PostgreSQL who need to perform schema changes on live databases without downtime or long-running locks. The codebase is actively maintained, supports modern Python versions, and carries no runtime dependencies beyond Django itself.
Use it for
- Add indexes to large production tables without blocking reads and writes during the migration window.
- Add or remove unique and check constraints safely using PostgreSQL's non-blocking constraint creation.
- Set columns to NOT NULL on populated tables by validating data before applying the constraint.
- Run all migrations with automatic statement and lock timeouts to prevent runaway queries from blocking the application.
- Add foreign keys to existing tables with validation and optional constraint deferral.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you run Django on PostgreSQL and perform schema migrations on live databases.
The package directly addresses a real production pain point—long-running migrations that lock tables—and is actively maintained with no external dependencies. The alpha status reflects early releases, but the core operations are straightforward and well-documented. Install if you need safer schema changes; skip if you use a different database backend or have no production migration concerns.
Install
django-pg-migration-tools on PyPI
Before you install
Low friction installation with no runtime dependencies. Actively maintained as of 2026-02-27 with recent releases. Supports current Python versions (3.10 through 3.14).
Requires Django and PostgreSQL; operations are PostgreSQL-specific and will not work with other database backends.
License in practice
BSD 3-Clause License permits commercial and private use with minimal restrictions; you may modify and distribute freely provided you retain copyright notices and disclaimers.
Quickstart
pip install django-pg-migration-tools
from django_pg_migration_tools.operations import SaferAddIndexConcurrently
class Migration(migrations.Migration):
operations = [
SaferAddIndexConcurrently(
model_name='mymodel',
index=models.Index(fields=['field_name'])
)
]
Verify before relying
- Minimum Django version requirement not specified in fact sheet.
- Whether all operations are backward-compatible with existing migration files.
- Performance impact of safer operations compared to standard Django migrations.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 168 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 76,180 / month, #14,650 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Typed |
Evidence: django_pg_migration_tools-0.1.26-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 › “concurrent index operations django”
- django-pg-migration-toolsProvides safer, production-ready Django migration operations for…
- django-elasticsearch-dslIndexes Django model instances into Elasticsearch and keeps them…
- django-snowflakeProvides a Django database backend that connects Django ORM to…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also django-pg-zero-downtime-migrations · django-postgres-extra · django-pgmigrate · squawk-cli · django-pglock · django-safemigrate · django-pgviews-redux · migra · yoyo-migrations · django-syzygy