This prompt is designed for release engineers and database reliability teams who need to evaluate migration scripts before production deployment. It takes dry-run output logs from a staging or production-like environment and produces a structured simulation report. Use this prompt when you have executed a migration in dry-run mode (or against a non-production clone) and captured the full output including timing, locks, errors, and resource metrics. The prompt does not execute migrations; it interprets execution artifacts to surface risks that manual log review would miss. This belongs in your pre-deployment checklist after dry-run execution and before the production change window opens.
Prompt
Migration Dry-Run Simulation Prompt

When to Use This Prompt
Defines the pre-deployment workflow for using the Migration Dry-Run Simulation Prompt to surface hidden risks in database migration scripts.
The ideal input is a complete, unredacted dry-run log containing DDL and DML statements, lock acquisition notices, timing measurements, error messages, and resource utilization metrics. The prompt expects you to supply this as [DRY_RUN_LOG] along with optional [SCHEMA_METADATA] describing table sizes, index definitions, and current constraint states. You can also provide [RISK_THRESHOLDS] to calibrate the simulation's sensitivity—for example, flagging any operation that holds an exclusive lock for more than 500ms or any statement that scans more than 10,000 rows. The prompt works best with structured log formats (e.g., PostgreSQL's EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) output or MySQL's SHOW PROFILE data), but it can also parse semi-structured CLI output if you include a [LOG_FORMAT] hint describing the tool and version that generated the logs.
Do not use this prompt as a substitute for actual dry-run execution. It cannot simulate a migration from a static SQL file alone—it requires real execution artifacts from a representative environment. It is also not a replacement for peer review of migration logic, nor does it validate business logic correctness (e.g., whether a column rename matches the application's expectations). The prompt's value is in pattern recognition across timing, locking, and error signals that humans often overlook when scanning thousands of lines of log output. After receiving the simulation report, you should still conduct a manual review of any high-severity findings and run the migration against a production-scale clone if the dry-run environment differs materially from production in data volume or concurrency patterns.
Use Case Fit
Where this prompt works and where it does not. Migration dry-run simulation requires structured input and clear boundaries to produce reliable pre-flight reports.
Good Fit: Structured Dry-Run Output
Use when: you have machine-generated dry-run logs with timestamps, lock acquisition events, and resource metrics. The prompt excels at parsing structured output from tools like pt-online-schema-change, gh-ost, or database-specific dry-run modes. Guardrail: validate that input logs contain required fields before invoking the prompt.
Bad Fit: Ad-Hoc Manual Testing
Avoid when: the only input is a developer's informal notes or a manual test run without timing data. The prompt cannot fabricate lock patterns or resource consumption from anecdotal evidence. Guardrail: require automated dry-run tooling as a prerequisite; reject inputs without structured metrics.
Required Input: Production-Like Schema
Risk: dry-run output against a stale or truncated schema produces misleading timing estimates and misses lock conflicts. Guardrail: confirm that the dry-run target schema matches production in table sizes, index presence, and constraint definitions before accepting simulation results.
Operational Risk: False Confidence
Risk: a clean dry-run report can create false confidence if the simulation environment lacks production concurrency, connection pool pressure, or replication lag. Guardrail: append a disclaimer section to every report listing what was not simulated and require a canary deployment step before full rollout.
Boundary: Cross-Service Locking
Risk: the prompt analyzes single-database lock patterns but cannot detect cross-service transaction deadlocks or application-level lock contention. Guardrail: flag any migration that touches tables accessed by multiple services and escalate to a cross-service review workflow.
Input Quality: Log Completeness
Risk: truncated or filtered dry-run logs hide warnings, skipped steps, or partial failures that would block production execution. Guardrail: verify log completeness by checking for expected start and end markers, and reject inputs that show signs of truncation or tool-level errors.
Copy-Ready Prompt Template
A copy-ready prompt template for simulating migration execution against production-like schemas and dry-run logs.
This prompt is designed to be pasted directly into your AI workflow. It instructs the model to act as a release engineer evaluating a database migration dry-run. The model will analyze provided logs and schema metadata to produce a structured simulation report. Before using this prompt, ensure you have captured the full dry-run output, the target schema DDL, and any relevant environment context. This prompt is not a substitute for actual execution in a staging environment; it is a pre-flight analysis tool to catch errors before they reach production.
textYou are a senior release engineer reviewing a database migration dry-run against a production-like schema. Your task is to produce a structured simulation report based on the provided dry-run output logs and schema context. ## INPUTS - Dry-Run Output Logs: [DRY_RUN_LOGS] - Target Schema DDL: [TARGET_SCHEMA_DDL] - Migration Script: [MIGRATION_SCRIPT] - Environment Context: [ENVIRONMENT_CONTEXT] ## OUTPUT SCHEMA Return a single JSON object with the following structure: { "execution_summary": { "status": "SUCCESS" | "WARNING" | "FAILURE", "total_statements": <number>, "errors_found": <number>, "warnings_found": <number>, "estimated_duration_seconds": <number> }, "findings": [ { "severity": "ERROR" | "WARNING" | "INFO", "statement_line": <number>, "statement_text": "<exact SQL from migration>", "category": "SYNTAX_ERROR" | "LOCK_ACQUISITION" | "TYPE_MISMATCH" | "CONSTRAINT_VIOLATION" | "RESOURCE_CONSUMPTION" | "TIMING_RISK" | "OTHER", "description": "<clear explanation of the finding>", "recommendation": "<actionable fix or mitigation>" } ], "lock_analysis": { "lock_type_expected": "<e.g., ACCESS EXCLUSIVE, ROW EXCLUSIVE>", "estimated_lock_duration_seconds": <number>, "blocking_risk": "HIGH" | "MEDIUM" | "LOW", "concurrent_operations_at_risk": ["<list of operations that may be blocked>"] }, "resource_warnings": [ { "resource": "DISK" | "MEMORY" | "CPU" | "I/O", "warning": "<description of potential resource exhaustion>", "mitigation": "<suggestion to reduce resource pressure>" } ], "rollback_assessment": { "is_rollback_possible": true | false, "rollback_script_provided": true | false, "irreversible_operations": ["<list of operations that cannot be rolled back>"], "data_loss_risk": "HIGH" | "MEDIUM" | "LOW" | "NONE" } } ## CONSTRAINTS - Base all findings strictly on the provided dry-run logs and schema DDL. Do not invent errors not present in the logs. - If a statement in the migration script is not reflected in the logs, flag it as an INFO finding with the category "MISSING_FROM_DRY_RUN". - For any ERROR severity finding, you must include a specific, actionable recommendation. - If the dry-run logs indicate a failure, the execution_summary.status must be "FAILURE". - Do not suggest fixes that require access to systems or data not described in the inputs. ## RISK_LEVEL [RISK_LEVEL] ## EXAMPLES [EXAMPLES]
To adapt this template, replace the square-bracket placeholders with actual data before execution. The [DRY_RUN_LOGS] should contain the complete, unaltered output from your migration tool's dry-run command. The [TARGET_SCHEMA_DDL] is the full DDL of the target database, which provides context for type and constraint checking. The [RISK_LEVEL] placeholder should be replaced with a brief description of the deployment's risk tolerance (e.g., 'HIGH - this is a core financial database, any error is critical'). The [EXAMPLES] placeholder can be populated with one or two few-shot examples of correctly formatted reports to improve output consistency. For high-risk environments, always route the final report for human review before proceeding with the actual migration.
Prompt Variables
Every placeholder the Migration Dry-Run Simulation Prompt expects, why it matters, and how to validate it before sending.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[MIGRATION_SCRIPT] | The full SQL migration script to be simulated | ALTER TABLE orders ADD COLUMN tax_rate DECIMAL(5,4) NOT NULL DEFAULT 0.0000; | Parse check: must be valid SQL. Schema check: all referenced tables and columns must exist in [TARGET_SCHEMA]. Reject empty or comment-only scripts. |
[TARGET_SCHEMA] | DDL snapshot of the production-like schema the migration will run against | CREATE TABLE orders (id BIGINT PRIMARY KEY, total DECIMAL(10,2), created_at TIMESTAMP); | Schema check: must be a complete, executable DDL. Cross-reference: every table referenced in [MIGRATION_SCRIPT] must appear here. Null not allowed. |
[DRY_RUN_OUTPUT] | Raw output logs from executing the migration in a dry-run or sandboxed environment | Query OK, 0 rows affected (0.12 sec) Lock acquired: orders (SHARED) ... | Parse check: must contain timing data, lock acquisition events, and row counts. Null allowed only if dry-run failed to execute; if null, set [EXECUTION_STATUS] to FAILED. |
[TABLE_STATS] | Row counts, index sizes, and storage metrics for each table in scope | orders: 14.2M rows, 3.1GB data, 4 indexes (2.8GB total index size) | Schema check: table names must match [TARGET_SCHEMA]. Value check: row counts must be non-negative integers. Null allowed for empty tables; if missing, lock escalation risk cannot be estimated. |
[EXECUTION_STATUS] | Whether the dry-run completed, failed, or timed out | COMPLETED | Enum check: must be one of COMPLETED, FAILED, TIMEOUT, or ABORTED. If FAILED, [DRY_RUN_OUTPUT] must contain error messages. If TIMEOUT, [LOCK_ACQUISITION_LOG] must show blocked locks. |
[LOCK_ACQUISITION_LOG] | Sequence of lock events captured during dry-run execution | T1: SHARED lock on orders (granted, 0.04s) T2: EXCLUSIVE lock on orders (waiting, 12.7s) | Parse check: each line must contain timestamp, lock type, table name, and status. Null allowed if dry-run used no-lock simulation mode; if null, lock escalation analysis will be skipped. |
[RESOURCE_CONSTRAINTS] | CPU, memory, I/O, and connection limits of the target database instance | 8 vCPU, 32GB RAM, 3000 IOPS, max_connections=200 | Value check: all numeric fields must be positive. Null allowed for cloud-managed instances where limits are elastic; if null, resource consumption warnings will use conservative defaults. |
[EXPECTED_DOWNTIME_THRESHOLD] | Maximum acceptable downtime in seconds for this migration window | 30 | Value check: must be a non-negative integer. If 0, any lock wait triggers a BLOCKING finding. If null, prompt will report downtime estimates without pass/fail judgment. |
Implementation Harness Notes
How to wire the Migration Dry-Run Simulation Prompt into a CI/CD pipeline or deployment workflow.
The Migration Dry-Run Simulation Prompt is designed to be the final automated gate before a migration script reaches production. It expects structured dry-run output logs as its primary input, which means your CI/CD pipeline must first execute the migration script against a production-like staging or ephemeral database and capture the full output. This includes timing metadata, lock acquisition logs, warning messages, and any error codes. The prompt does not execute the migration itself; it interprets the results of that execution. Your harness is responsible for running the dry run, collecting the logs, and feeding them to the model in the [DRY_RUN_OUTPUT] placeholder along with the migration script content in [MIGRATION_SCRIPT] and relevant schema metadata in [SCHEMA_CONTEXT].
The harness should enforce a strict validation contract on the model's output. Define an expected JSON schema for the simulation report that includes fields for overall_risk_level, errors_found, warnings, estimated_duration_seconds, lock_acquisition_issues, and resource_consumption_warnings. After the model responds, validate the output against this schema. If validation fails, implement a retry loop with a maximum of two attempts, appending the validation error to the prompt context so the model can self-correct. For high-risk migrations—those classified as CRITICAL or HIGH risk by the model—the harness must automatically create a manual review ticket in your project management system and block the deployment pipeline until a human approves the report. Log every prompt invocation, the raw model response, the validation result, and the final disposition (auto-approved, flagged for review, or failed) to an audit table for post-deployment traceability.
Model choice matters for this workflow. The prompt requires strong reasoning over structured logs and schema definitions, so prefer models with large context windows and strong code-reasoning capabilities. If your dry-run output is exceptionally large, implement a pre-processing step that extracts only the relevant sections—error lines, timing summaries, and lock statements—to keep the prompt within token limits. Do not truncate the output arbitrarily; use a targeted extraction step that preserves diagnostic signal. Finally, never allow the harness to automatically apply a migration based solely on a passing simulation report. The prompt's output is a risk assessment, not a deployment authorization. Always keep a human approval step for production migrations, and use this prompt to make that approval decision faster and more informed.
Expected Output Contract
The JSON structure the prompt must return after processing dry-run logs. Use this contract to validate the model's output before surfacing findings to release engineers.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
simulation_id | string | Must match the [SIMULATION_ID] input exactly. Fail if missing or mismatched. | |
migration_script | string | Must be a non-empty string matching the [SCRIPT_NAME] input. Fail if null or empty. | |
execution_status | enum: success | failure | timeout | partial | Must be one of the four allowed enum values. Fail on any other string. | |
estimated_duration_seconds | number | Must be a positive float. Warn if > 3600 (potential long-running migration). Fail if negative or zero. | |
errors | array of objects | If execution_status is failure or partial, this array must contain at least one error object. Each object must have non-empty 'error_code' and 'error_message' string fields. | |
lock_acquisitions | array of objects | Each object must contain 'table_name' (string), 'lock_type' (enum: ACCESS_EXCLUSIVE | ROW_EXCLUSIVE | ACCESS_SHARE), and 'duration_ms' (positive integer). Fail if lock_type is not in enum. | |
resource_warnings | array of strings | If present, each string must be non-empty. Null entries in the array should be filtered out by the validator. Warn if array is empty but estimated_duration_seconds > 600. | |
rollback_safety | object | Must contain 'safe_to_rollback' (boolean) and 'rollback_script' (string or null). If safe_to_rollback is true, rollback_script must be a non-empty string. If false, rollback_script must be null. |
Common Failure Modes
What breaks first when the Migration Dry-Run Simulation Prompt is used in production, and how to guard against each failure.
Incomplete Dry-Run Log Ingestion
What to watch: The model receives truncated or filtered dry-run logs that omit critical warnings, lock acquisition details, or resource metrics. This produces a simulation report that looks clean but misses real production risks. Guardrail: Validate log completeness before prompting—check for expected sections (lock output, timing estimates, error streams) and enforce a minimum log verbosity threshold. Reject inputs that don't meet the schema.
Hallucinated Timing Estimates
What to watch: The model generates plausible but fabricated execution times, lock durations, or resource consumption numbers when the dry-run output lacks explicit metrics. These invented numbers can mislead release planning. Guardrail: Require the prompt to mark any timing or resource claim not directly extracted from the input as [ESTIMATED - NO SOURCE DATA]. Add a post-processing validator that flags numeric claims without corresponding log evidence.
Misclassification of Lock Severity
What to watch: The model downplays or exaggerates lock acquisition patterns—treating an AccessExclusiveLock on a small table as benign or a brief RowExclusiveLock as a blocker. This skews downtime risk assessment. Guardrail: Embed a lock severity reference table in the prompt context (lock type × table size × access pattern). Run a second-pass evaluation prompt that scores lock risk independently and flags disagreements with the primary report.
Schema-Version Mismatch Drift
What to watch: The dry-run was executed against a stale schema snapshot, but the prompt treats it as current production state. The simulation report validates operations that would fail against the actual live schema. Guardrail: Require the input to include a schema version hash or timestamp. The prompt must refuse to proceed if the schema metadata is older than a configurable threshold (e.g., 1 hour). Log version provenance in the output.
Rollback Step Omission
What to watch: The simulation report focuses entirely on forward execution success and omits analysis of rollback feasibility, leaving operators without a recovery path when the migration fails mid-flight. Guardrail: Add a dedicated output section requirement: 'Rollback Feasibility Assessment.' If the dry-run logs contain no rollback simulation data, the prompt must explicitly state 'ROLLBACK NOT TESTED' as a high-severity finding rather than remaining silent.
Resource Contention Blind Spots
What to watch: The dry-run captures I/O and CPU metrics from a quiet test environment, but the prompt doesn't flag that production contention (replication lag, concurrent workloads, connection pool exhaustion) is absent from the simulation. Guardrail: Include a 'Simulation Fidelity Caveats' section in the prompt output schema. Require the model to list what production factors were NOT simulated (e.g., replication, connection storms, backup windows) and assign a confidence penalty to the report.
Evaluation Rubric
Use this rubric to test the Migration Dry-Run Simulation Prompt before deploying it into your CI/CD pipeline. Each criterion targets a specific failure mode common to migration analysis outputs.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Error Classification Accuracy | All errors in [DRY_RUN_OUTPUT] are correctly classified as blocking, warning, or informational | A blocking error is labeled as a warning, or a benign notice is escalated to blocking | Run against a curated log containing one known instance of each severity level and verify labels match |
Timing Estimate Plausibility | Estimated duration is within 50% of the actual dry-run execution time reported in [DRY_RUN_OUTPUT] | Estimate is off by more than 100% or claims zero-duration for a non-trivial operation | Compare the prompt's timing estimate against the actual elapsed time recorded in the dry-run log |
Lock Acquisition Pattern Detection | All lock types and target tables are identified and matched to specific log lines | A table-level exclusive lock is missed, or a lock is attributed to the wrong table | Provide a dry-run log with known lock events and check that every lock appears in the output with correct table name and lock mode |
Resource Consumption Warning Completeness | Warnings are generated for any operation exceeding 80% of available memory or disk as declared in [RESOURCE_LIMITS] | A memory spike to 95% produces no warning, or a warning fires at 30% utilization | Inject a synthetic resource spike into the dry-run log and verify the warning appears with the correct threshold reference |
Rollback Safety Flag Accuracy | Irreversible operations are flagged with a specific reason and the exact DDL statement referenced | A DROP COLUMN is marked as reversible, or a CREATE INDEX is flagged as irreversible | Include one reversible and one irreversible operation in the test log and verify flags match expected safety classification |
Output Schema Compliance | The output strictly matches [OUTPUT_SCHEMA] with all required fields present and no extra top-level keys | A required field is missing, a field type is wrong, or an undocumented field appears | Validate the JSON output against the schema using a programmatic schema validator before human review |
Source Grounding | Every finding includes a reference to a specific line number or timestamp from [DRY_RUN_OUTPUT] | A finding states a conclusion without pointing to evidence in the log, or cites a line that does not exist | Spot-check three findings and confirm the cited line exists and supports the claim made |
Uncertainty Handling | Ambiguous log entries are flagged with an explicit confidence qualifier and a recommendation to escalate | An ambiguous entry is reported as a definitive finding, or a clear error is hedged with unnecessary uncertainty | Include a deliberately ambiguous log line and verify the output uses qualifying language and suggests human review |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single dry-run log and lighter validation. Remove strict schema enforcement and focus on generating a readable simulation report. Accept plain-text log input without requiring structured parsing.
Prompt modification
- Replace [OUTPUT_SCHEMA] with a simple markdown table format
- Remove [CONSTRAINTS] around lock duration precision and timing estimates
- Add: "If the dry-run log is incomplete, note what's missing and proceed with available data"
Watch for
- Missing schema checks that hide real migration failures
- Overly broad instructions producing vague risk assessments
- No distinction between warnings and blocking errors

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us