- Home
- Skills
- Data & Databases
- zerodowntime db
Works with the AI Agents you already use
zerodowntime db
Detect and remediate dangerous database locks with zero-downtime migration linting and 3-phase deployment patterns.
Free
zerodowntime db
Example session with this skill installed
I need to add a UNIQUE constraint to the email column on my production Postgres 15 orders table. It has 50 million rows. Give me the zero-downtime migration steps.
- Read your context and instructions
- Compiled the zerodowntime db
I have analyzed the request to add a UNIQUE constraint to a high-traffic table. A direct ALTER TABLE will acquire an ACCESS EXCLUSIVE lock, blocking all traffic. I have generated a 2-step safe migration plan.
Zero-Downtime Unique Constraint Plan
-- Phase 1: Create the unique index concurrently.
-- This does not block reads or writes but takes longer to run.
-- Run this OUTSIDE of a transaction block.
SET lock_timeout = '5s';
CREATE UNIQUE INDEX CONCURRENTLY idx_orders_email_unique ON orders (email);
-- Phase 2: Attach the constraint using the existing index.
-- This requires a microsecond ACCESS EXCLUSIVE lock for metadata only.
SET lock_timeout = '2s';
ALTER TABLE orders
ADD CONSTRAINT uq_orders_email
UNIQUE USING INDEX idx_orders_email_unique;
Next steps
- Ensure your migration runner (e.g., Flyway or Prisma) is configured for non-transactional execution for Phase 1.
- Monitor
pg_stat_activityduring the concurrent index build to ensure it doesn't conflict with long-running maintenance tasks. - Verify the index status using
\d ordersafter Phase 1 to ensure it is not marked asINVALID.
Connects securely to your tools. The creator never sees your data.
About this skill
Database migrations on high-traffic tables are a common source of production outages. A single ALTER TABLE can lock out all application traffic, leading to connection exhaustion and 504 errors. This skill provides an automated linter and architectural advisor to ensure DDL changes execute without downtime.
What it does
- Hazard detection identifies dangerous table locks like
ACCESS EXCLUSIVE, non-concurrent indexes, and full table rewrites. - Migration conversion automatically rewrites breaking DDL into 3-phase Expand-and-Contract deployment scripts.
- Lock enforcement injects mandatory fail-fast lock timeouts into SQL, Prisma, Alembic, and Rails migrations.
- Batched backfilling generates throttleable background update logic to populate columns without saturating I/O or replication.
- ORM guardrails provides specific configurations for ActiveRecord, Prisma, and SQLAlchemy to handle non-transactional DDL.
How it works
- Lint migrations by running the included linter script against your SQL or ORM migration directory.
- Review the hazard report to identify statements that will block reads or writes.
- Refactor unsafe migrations using the suggested remediations, such as
CONCURRENTLYindex builds orNOT VALIDconstraints. - Integrate the pre-commit hook or GitHub Action to catch locking hazards before they reach production.
Frameworks & tools
Supports PostgreSQL (12-17) and MySQL (5.7-8.4). Includes specific implementation logic for Prisma, Alembic (SQLAlchemy), Ruby on Rails (ActiveRecord), Flyway, gh-ost, and pt-online-schema-change.
Why this beats prompting it yourself
Generic AI often forgets the nuances of lock hierarchies or database-specific version optimizations like Postgres 12+ constraint validation. This skill uses a strict "Three Axioms" framework to ensure every migration is structurally safe for high-concurrency environments.
Use cases
- Adding unique constraints or indexes to tables with millions of rows.
- Renaming columns in production without breaking running application instances.
- Adding
NOT NULLconstraints to existing columns without full table scans. - Migrating large column types using online schema change tools like gh-ost.
Known limitations
Does not support NoSQL databases or older versions of PostgreSQL (sub-12). Requires Python 3.11 for the standalone linter script.
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
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 15 days ago
- Free with an Agensi account
- Software
Python
Permissions
What's inside
Frequently Asked Questions
New in Data & Databases
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.