- Home
- Skills
- Data & Databases
- Zero-Downtime PostgreSQL Migrations
Works with the AI Agents you already use
Zero-Downtime PostgreSQL Migrations
Lint, preflight, rehearse and apply DDL with lock_timeout and retries, so no more migration outages.
$19
Zero-Downtime PostgreSQL Migrations
Example session with this skill installed
Request: "Review migrations/0042_orders.sql before we run it on production. orders has 40M rows."
- Read your context and instructions
- Compiled the zero-downtime postgresql migrations
The agent runs scripts/migration_lint.py before touching the database:
ERROR :2 volatile-default-rewrite ADD COLUMN with a volatile DEFAULT rewrites the whole table under ACCESS EXCLUSIVE.
ERROR :3 index-not-concurrent CREATE INDEX without CONCURRENTLY blocks writes for the whole build.
ERROR :4 constraint-not-valid ADD FOREIGN KEY validates all rows while locking.
ERROR :5 column-type-rewrite ALTER COLUMN TYPE rewrites the table and its indexes.
ERROR :8 unbounded-update UPDATE without WHERE rewrites every row in one transaction.
ERROR :11 concurrently-in-transaction CREATE INDEX CONCURRENTLY cannot run inside BEGIN/COMMIT.
WARNING :2 no-lock-timeout DDL before 'SET lock_timeout'.
Summary: 8 error(s), 2 warning(s), 2 info
Result: the agent refuses to apply the file and rewrites it with the recipes in references/safe-patterns.md: SET lock_timeout = '3s'; the column added without a default and backfilled in batches; CREATE INDEX CONCURRENTLY IF NOT EXISTS outside the transaction; the foreign key added NOT VALID and validated in a separate step; the type change done as add-column + backfill + swap. The rewritten file passes the linter with 0 errors. It then runs the read-only preflight (long transactions, lock waits, replication lag) and rehearses the migration twice on a schema-only copy before asking you to type the database name to apply it.
Connects securely to your tools. The creator never sees your data.
About this skill
Zero-downtime PostgreSQL migrations: lint for 24 lock and data-loss hazards, preflight for long transactions and lock queues, rehearse on a schema copy, then apply with lock_timeout and automatic retries. Prevents the classic "index build took the site down".
Why this instead of a free prompt
Free skills ask the model to "be careful". These ship executable gates: a migration that would lock a busy table fails the linter; an alert that references a metric your Prometheus does not have fails verification; a Compose rollout that turns unhealthy rolls itself back. Every script was run against real PostgreSQL 16, Docker 29, ansible-core and Prometheus with node_exporter and postgres_exporter before release.
How it keeps you safe
- Read-only pre-flight first: diagnostics that change nothing.
- Dry-run by default. Anything that changes state needs an explicit apply step and a typed confirmation.
- Rollback built in, and guardrails that refuse unsafe input.
- No secrets printed in output.
Requirements
Python 3.8+, psql, pg_dump. Runs on RHEL/AlmaLinux 8+ and Debian 11+/Ubuntu 20.04+.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.
Not for: MySQL, SQLite or query tuning. Requires Python 3.8+, psql and pg_dump on Linux (RHEL/AlmaLinux 8+, Debian 11+/Ubuntu 20.04+).
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 5 days ago
- Software
Python 3.8+psqlpg_dump