$npx skillfedfor your agent

django-pg-zero-downtime-migrations

Django postgresql backend that apply migrations with respect to database locks

With conditionsPyPI DatabaseReleased Jun 2025263.7K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — django_pg_zero_downtime_migrations-0.19-py3-none-any.whl
v0.19 · released 2025-06-06 · Python >=3.8 · 1 runtime deps: django

Yes, with conditions. Install this if you need zero-downtime schema migrations on PostgreSQL and can follow the deployment flow (apply migrations, then restart instances one at a time). The package is mature enough for production use (MIT licensed, actively maintained, 573 stars) but remains in beta—test all migrations thoroughly before production deployment. Not suitable if your migrations rely heavily on RunPython operations or if you cannot orchestrate instance restarts behind a load balancer.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires PostgreSQL database; does not apply zero-downtime guarantees to RunPython operations, only schema and RunSQL migrations.
  • Migrations are not wrapped in transactions, so partial failures require manual database state recovery.
  • Low friction installation with a single dependency on django.

License · maintenance · safety

MIT (permissive) — MIT license is permissive and imposes no restrictions on use, modification, or distribution in commercial or private projects.

last release 2025-06-06 (434 days) · last repo commit 2025-11-12 · 573 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 263,718 downloads/mo, #8,351 on PyPI

Verify before relying

pip install django-pg-zero-downtime-migrations

In settings.py:
DATABASES = {
    'default': {
        'ENGINE': 'django_zero_downtime_migrations.backends.postgres',
        ...
    }
}
ZERO_DOWNTIME_MIGRATIONS_LOCK_TIMEOUT = '2s'
ZERO_DOWNTIME_MIGRATIONS_STATEMENT_TIMEOUT = '2s'
ZERO_DOWNTIME_MIGRATIONS_RAISE_FOR_UNSAFE = True
  • Whether idempotent mode (ZERO_DOWNTIME_MIGRATIONS_IDEMPOTENT_SQL) is suitable for production CI pipelines given its reliance on name and constraint state checks rather than full transaction semantics.
  • Performance impact of explicit constraint dropping (ZERO_DOWNTIME_MIGRATIONS_EXPLICIT_CONSTRAINTS_DROP) on large tables with many foreign keys.
  • Compatibility with PgBouncer transaction pool mode and whether session pool mode is required for timeout settings to function correctly.
Same gist for agents: .md · .json

What it is and what it does

django-pg-zero-downtime-migrations is a custom Django database backend for PostgreSQL that replaces the standard backend to apply schema migrations while respecting database-level locks. Instead of using transactions for all migrations (which can cause table locks and downtime), it applies schema changes and SQL operations in a way that minimizes lock contention and allows the application to remain available during deployment.

The package works by managing PostgreSQL's table-level locks—ACCESS EXCLUSIVE, SHARE UPDATE EXCLUSIVE, and others—and applying configurable timeouts to prevent long-running operations from blocking application queries. It requires careful deployment orchestration: migrations are applied first, then application instances are restarted one at a time behind a load balancer to ensure the old and new application versions both work with the new schema. The package is in beta and does not apply zero-downtime guarantees to RunPython operations, only to schema and RunSQL migrations.

Use it for

  • Deploying schema changes to a live PostgreSQL database serving multiple application instances without taking the application offline.
  • Adding or modifying columns and indexes on large tables where standard Django migrations would cause extended lock times.
  • Recovering from partial migration failures by re-running failed migrations in idempotent mode after fixing underlying data issues.
  • Enforcing safe migration practices by raising errors on potentially unsafe operations when ZERO_DOWNTIME_MIGRATIONS_RAISE_FOR_UNSAFE is enabled.
  • Managing long-running operations like index creation or constraint validation without triggering global statement timeouts.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, with conditions.

Install this if you need zero-downtime schema migrations on PostgreSQL and can follow the deployment flow (apply migrations, then restart instances one at a time). The package is mature enough for production use (MIT licensed, actively maintained, 573 stars) but remains in beta—test all migrations thoroughly before production deployment. Not suitable if your migrations rely heavily on RunPython operations or if you cannot orchestrate instance restarts behind a load balancer.

Install

django-pg-zero-downtime-migrations on PyPI

Before you install

Low friction installation with a single dependency on django. The package is marked beta and aging (434 days since release), but the repository remains active with recent commits and moderate community adoption (573 stars). Suitable for production use with careful testing of migrations before deployment.

Requires PostgreSQL database; does not apply zero-downtime guarantees to RunPython operations, only schema and RunSQL migrations. Migrations are not wrapped in transactions, so partial failures require manual database state recovery.

License in practice

MIT license is permissive and imposes no restrictions on use, modification, or distribution in commercial or private projects.

Quickstart

pip install django-pg-zero-downtime-migrations

In settings.py:
DATABASES = {
    'default': {
        'ENGINE': 'django_zero_downtime_migrations.backends.postgres',
        ...
    }
}
ZERO_DOWNTIME_MIGRATIONS_LOCK_TIMEOUT = '2s'
ZERO_DOWNTIME_MIGRATIONS_STATEMENT_TIMEOUT = '2s'
ZERO_DOWNTIME_MIGRATIONS_RAISE_FOR_UNSAFE = True

Verify before relying

  • Whether idempotent mode (ZERO_DOWNTIME_MIGRATIONS_IDEMPOTENT_SQL) is suitable for production CI pipelines given its reliance on name and constraint state checks rather than full transaction semantics.
  • Performance impact of explicit constraint dropping (ZERO_DOWNTIME_MIGRATIONS_EXPLICIT_CONSTRAINTS_DROP) on large tables with many foreign keys.
  • Compatibility with PgBouncer transaction pool mode and whether session pool mode is required for timeout settings to function correctly.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
django
MaintenanceAging 434 days since the last release
Last repo commit
First released
Downloads263,718 / month, #8,351 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Evidence: django_pg_zero_downtime_migrations-0.19-py3-none-any.whl

Tags

Capabilities
django postgres migrations zero downtimepostgresql schema changes without lockingdjango migration lock managementzero downtime database migrationspostgres table lock avoidancedjango deployment without downtimesafe postgresql schema operations
Topics
postgres-migrationszero-downtime-deploymentdjango-backend
PyPI keywords
djangopostgrespostgresqlmigrations

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 postgres migrations zero downtime”

Give your agent the search over MCP, or paste the wish link into any chat.

More Database packages

psycopg2-binary Worth it
PyPI · Software Development · released Apr 2026

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.

copyleftcompiled wheel · 3.9+
271.6Mdownloads / mo
redis Worth it
PyPI · Database · released Jul 2026

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.

MITpure Python · 3.10+
268.3Mdownloads / mo
ydb Worth it
PyPI · Database · released Jul 2026

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.

permissive licensepure Python · 3.10+
210.0Mdownloads / mo
snowflake-connector-python Worth it
PyPI · Software Development · released Aug 2026

Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.

Apache-2.0compiled wheel · 3.10+
193.6Mdownloads / mo
sqlparse Worth it
PyPI · Software Development · released Aug 2026

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.

BSD-3-Clausepure Python · 3.10+
148.9Mdownloads / mo
dbt-adapters With conditions
PyPI · Database · released Jul 2026

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.

Apache-2.0pure Python · 3.10.0+
121.3Mdownloads / mo

See also django-pg-migration-tools · django-pgmigrate · django-postgres-extra · migra · squawk-cli · django-syzygy · django-pglocks · django-pglock · django-safemigrate · yoyo-migrations