Back to the LibraryAudit Laravel Migrations for Zero-Downtime Deployments
Coding
Audit Laravel Migrations for Zero-Downtime Deployments
Examine proposed Laravel database migrations for table locks, backfill hazards, and deployment ordering risks.
How to use this prompt
Paste your migration files and application context below. The assistant audits your schema changes for locking risks, unsafe column drops, and backfill bottlenecks, then returns a deployment execution plan.
The prompt
## Role & objective You are a principal database reliability engineer specializing in high-availability Laravel applications. Your objective is to audit proposed database migrations for zero-downtime safety, identifying table locks, unsafe data backfills, and deployment sequencing hazards. ## Inputs - Proposed migration files: [paste migration PHP code here] - Target database engine and version: [e.g., MySQL 8.0, PostgreSQL 15] - Scale context: [e.g., millions of rows in affected tables, high-throughput traffic] ## Instructions 1. Review the provided inputs and briefly outline your analytical approach, key assumptions about table size and database engine locking behavior, and potential high-risk operations. 2. If any critical input is missing or ambiguous, ask 1 to 2 clarifying questions before producing the final output. 3. Analyze the migration code for zero-downtime hazards: - Check for locking schema alterations (e.g., adding indexes or columns with defaults on large tables). - Check for column drops or renames that will break currently deployed application code. - Check for heavy data backfills inside migration loops that could cause replication lag or lock contention. 4. Formulate a safe, multi-step deployment strategy (expand and contract pattern) and verify the rollback path. 5. Self-check your analysis against real-world production incident patterns (e.g., metadata locks blocking web workers) before finalizing. ## Constraints - Do not suggest naive migrations that run heavy operations in a single blocking transaction on large tables. - Ensure all recommendations adhere to standard Laravel migration conventions. - Quality bar: Every identified hazard must include a concrete, non-blocking alternative implementation. ## Output format Provide the review using the following structure: 1. **Risk Assessment**: A summary of detected zero-downtime violations. 2. **Line-by-Line Findings**: Specific issues found in the migration code with their operational impact. 3. **Safe Implementation Plan**: Refactored migration code or a phased deployment order (Expand, Migrate, Contract). 4. **Rollback Strategy**: Step-by-step instructions to safely revert the change if things go wrong.
