# PostgreSQL Migration Lock Review

PostgreSQL Migration Lock Review is a tested SKILL.md that reviews ONE PostgreSQL migration file for the four statements that lock or rewrite a table that is already in use, and lists only those, one line each with a fixed code, the statement, why it hurts and the fix - or exactly No findings; an agent buys it once for $0.01 over x402.

- Page: https://aiskills402.com/skills/postgres-migration-lock-review
- Category: Code & Engineering (https://aiskills402.com/categories/code)
- Price: $0.01 once, USD-priced, paid in USDC on Base over x402. Price as loaded on this page. The 402 response your agent receives is authoritative.
- Version: 1.0.0
- Card (JSON): https://api.aiskills402.com/v1/skills/postgres-migration-lock-review

## Use it when

Reviews ONE PostgreSQL migration file for the four statements that lock or rewrite a table that is already in use, and lists only those, one line each with a fixed code, the statement, why it hurts and the fix - or exactly No findings. It catches CREATE INDEX without CONCURRENTLY on an existing table, a not-null or constraint check run in one blocking step, a column type change or volatile default that rewrites the table, and a drop or rename of a column that running code may still read. It leaves out the safe look-alikes, such as an index built concurrently, a column added with a constant default, a constraint added NOT VALID and validated separately, and the drop of a column the file says nothing reads. Use to review a migration before deploy, to plan a zero-downtime change, or to check a schema pull request.

## Not for

Query tuning, data correctness after a backfill, MySQL or SQLite syntax, ORMs that generate the SQL at run time and server settings such as lock timeouts. It reads one pasted migration, assumes a currently supported PostgreSQL version and judges only what is written in the file.

## Tested, honestly

Tested 2026-10-26.

- Strong model (claude-sonnet-5-5 (Claude Code alias "sonnet")): Right on all 3 cases, read by hand. On the orders migration it found the plain index and the not-null set in one step, and left out the concurrent index and the column with a constant default. On the invoices migration it found the type change that computes new values and the rename of a column still in use, and left out the drop the file calls unused and the constraint that was added NOT VALID and validated on its own. On the clean events migration it answered exactly No findings.
- Weak model (claude-haiku-5-5 (Claude Code alias "haiku")): Right on all 3 cases, read by hand. It matched the strong model on both planted files, with sound fixes and the NOT VALID sequence spelled out, and kept every safe look-alike out of its list: the concurrent index, the constant default, the unused column and the validated constraint. On the clean migration, with a plain index on a table created in the same file, it answered exactly No findings.

Note: Light test: three cases (two planted, one clean), one run per model; no comparison without the skill. The three inputs were written by us; each planted one carries a safe look-alike and neither planted case has a comment pointing at the defect (the comments only give the deploy context and one fact about use). The skill assumes a currently supported PostgreSQL version. Facts come from the current PostgreSQL manual, read on 26 October 2026; there are no owner-measured facts.

Full summary: https://aiskills402.com/skills/postgres-migration-lock-review/tests

## Example

### English (claude-sonnet-5-5)

Before:

> -- Deploy note: the old app version keeps serving traffic while this migration runs. -- The orders table has about 300 million rows. CREATE INDEX idx_orders_customer ON orders (customer_id); CREATE INDEX CONCURRENTLY idx_orders_created ON orders (created_at); ALTER TABLE orders ADD COLUMN channel text NOT NULL DEFAULT 'web'; ALTER TABLE orders ALTER COLUMN customer_id SET NOT NULL;

After:

> INDEX-BLOCKS-WRITES — CREATE INDEX idx_orders_customer ON orders (customer_id) — a non-concurrent build blocks inserts, updates and deletes on orders (about 300 million rows per the file's note) until it finishes, while the old app is still serving traffic — use CREATE INDEX CONCURRENTLY, outside a transaction block…

## What is in the file

- What the PostgreSQL documentation says, as published on 26 October 2026
- The answer
- The codes
- Rules
- Work in this order
- Short example

## Languages

English

## How to buy

Agent (HTTP):

1. GET https://api.aiskills402.com/v1/skills/postgres-migration-lock-review/file without a payment header. The answer is 402 with a PAYMENT-REQUIRED header (x402 v2): exact amount, asset, network, recipient.
2. Sign `accepts[0]` with an x402 client (for example @x402/core + @x402/evm).
3. Repeat the GET with the signature in the PAYMENT-SIGNATURE header. The answer is 200 with the file, its sha256 and a re-download token.

Agent (MCP): https://mcp.aiskills402.com/mcp — free tools search_skills, get_skill, redownload_skill. Buying itself is over HTTP.

Full flow: https://aiskills402.com/docs

## The file

- Version: 1.0.0
- Size: 6.9 KB (7068 bytes)
- SHA-256: 4ce666d04e3a5a9dc2784ba1c4f33ae58234be4dd339b6aa4e0793c31bdf899a
- Updated: 2026-10-26
- New versions are free through your re-download token.

## Versions

### 1.0.0 (2026-10-26)

First release, written in the light-test batch of 26 October 2026 (three cases, price $0.01). The idea is ours; no foreign skill was opened, facts come from public documentation (see notes/ideas.md). Output: see the skill description.

Test: three cases written by hand (two planted, each with a safe look-alike, one clean control), one run on Claude Sonnet and one on Claude Haiku, no run without the skill, no iteration on the skill rules after the runs. `test/control.mjs` shows that the checks pass on the ideal answers and fail on realistic wrong ones. See `test-summary.json` for the verdicts read by hand.

## License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Terms: https://aiskills402.com/docs#license

## FAQ

### Is a plain index on a brand-new table reported?

No. A table that this very file creates holds no rows yet, so nothing is blocked. Only an index on a table that already existed, built without CONCURRENTLY, earns a line.

### Does a NOT NULL after a validated check count as one step?

No. The documentation says a valid check constraint lets SET NOT NULL skip its scan, so adding the check NOT VALID, validating it and then setting the not-null is treated as the safe sequence.

### Which migrations went into the test?

Three migration files we wrote ourselves: an orders change that mixes a concurrent index with a constant-default column, an invoices change that computes a new numeric type and renames a column in use next to a drop the file declares unused, and a clean events change. Each model got every file one time.

### What does a safe migration return?

One sentence only: No findings. Anything wrong is reported as a separate line made of the code, the statement, the damage and the repair, while the statements that were read and approved are never recited back.

## Measurement limits

- Models other than the two named above were not run.
- Each verdict comes from the test run on the date shown; the skill may have changed since (check the version).
- Full test inputs are not published here, only short excerpts of our own text.
- Results on your own texts, languages and domains can differ.

Offer note: Paid in USDC (USD-pegged) over x402 by an AI agent; one-time.
