Prompier
ApprovedEngineeringmigrationrelease

Database migration safety review

PL by Prompier Library ☆☆☆☆☆ New Version 1 · updated Nov 10, 2026
Reviewed by moderator Prompier Library on Nov 10, 2026. Checked for personal data, secrets, risky instructions and a clear license.

About this prompt

Reviews a schema migration for production risks such as long locks, data loss and breaking running code, and proposes a safer rollout. Use before shipping any change to a live database.

Prompt text

You are a database reliability engineer. Review the migration below for production risk and propose a safer way to ship it. Inputs - Migration code (raw SQL or generated by a framework): {{migration_code}} - Database engine and version: {{database_and_version}} - Approximate table sizes and traffic during deploys: {{size_and_traffic}} - How the application is deployed (rolling, all at once, downtime allowed) and whether a rollback is expected: {{deploy_process}} Steps 1. Restate in plain words what the migration changes. If the engine, version or table sizes are missing and they change the answer, ask up to 3 questions; otherwise state your assumptions and proceed. 2. Check each statement for these risks: - Locks that block reads or writes, and how long they could last on tables of this size. - Full table rewrites or index builds that run without concurrency options. - Data loss: dropped columns or tables, narrowing types, truncating changes, constraints that would reject existing rows. - Compatibility with the running application: old code reading the new schema and new code reading the old schema during a rolling deploy. - Backfills that update many rows in one transaction. - Missing or untested rollback path. 3. Rate each finding as blocker, high, medium or low, with the reason. 4. Propose a safer sequence, often in several releases: add nullable or defaulted structure, deploy code that works with both, backfill in batches, validate, then enforce constraints and remove old structure. 5. Give a pre-deploy checklist and a rollback plan. Output format - Verdict: safe, safe with changes, or do not ship - Findings table (statement, risk, severity, fix) - Proposed rollout in numbered steps - Verification queries or checks to run before and after - Rollback plan Quality bar - Be specific to the engine and version given; say when behavior varies by version. - Do not assume small tables; reason from the sizes provided. - Never suggest running untested changes directly on production.

Variables

4 variables
VariableWhat to enterExampleDefault
{{migration_code}}Paste the migration, as SQL or framework codeALTER TABLE orders ADD COLUMN status text NOT NULL DEFAULT 'new'; CREATE INDEX ON orders(status);—
{{database_and_version}}Database engine and versionPostgreSQL 15—
{{size_and_traffic}}Rough table sizes and traffic during deploysorders has 80 million rows; about 200 writes a second—
{{deploy_process}}How the application is deployedRolling deploy, migrations run before new servers start—

Try it

Live preview
Paste the migration, as SQL or framework code
Database engine and version
Rough table sizes and traffic during deploys
How the application is deployed
Your finished prompt
You are a database reliability engineer. Review the migration below for production risk and propose a safer way to ship it. Inputs - Migration code (raw SQL or generated by a framework): {{migration_code}} - Database engine and version: {{database_and_version}} - Approximate table sizes and traffic during deploys: {{size_and_traffic}} - How the application is deployed (rolling, all at once, downtime allowed) and whether a rollback is expected: {{deploy_process}} Steps 1. Restate in plain words what the migration changes. If the engine, version or table sizes are missing and they change the answer, ask up to 3 questions; otherwise state your assumptions and proceed. 2. Check each statement for these risks: - Locks that block reads or writes, and how long they could last on tables of this size. - Full table rewrites or index builds that run without concurrency options. - Data loss: dropped columns or tables, narrowing types, truncating changes, constraints that would reject existing rows. - Compatibility with the running application: old code reading the new schema and new code reading the old schema during a rolling deploy. - Backfills that update many rows in one transaction. - Missing or untested rollback path. 3. Rate each finding as blocker, high, medium or low, with the reason. 4. Propose a safer sequence, often in several releases: add nullable or defaulted structure, deploy code that works with both, backfill in batches, validate, then enforce constraints and remove old structure. 5. Give a pre-deploy checklist and a rollback plan. Output format - Verdict: safe, safe with changes, or do not ship - Findings table (statement, risk, severity, fix) - Proposed rollout in numbered steps - Verification queries or checks to run before and after - Rollback plan Quality bar - Be specific to the engine and version given; say when behavior varies by version. - Do not assume small tables; reason from the sizes provided. - Never suggest running untested changes directly on production.

Sample output

Verdict: safe with changes. As written, step 2 can block writes on orders for several minutes. | Statement | Risk | Severity | Fix | | ALTER TABLE orders ADD COLUMN status NOT NULL | Rewrites a 40M-row table on older versions | Blocker | Add nullable, backfill in batches, then add constraint | | DROP COLUMN legacy_ref | Old app version still reads it during rolling deploy | High | Remove in a later release | | CREATE INDEX ... | Blocks writes | High | Build concurrently | Rollout 1. Release A: add nullable column and index (concurrently). 2. Release B: code writes both, reads new. 3. Backfill 10k rows per batch. 4. Release C: add constraint, then drop the old column. Rollback: Release A and B are reversible by dropping the new column.

An example the author shared. Your result will differ.

Reviews

No written reviews yet. If you have used this prompt, tell others how it went.