lc-migration-fresh-test
Run migrate:fresh in Docker and report errors with fix suggestions.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Run migrate:fresh in Docker and report errors with fix suggestions.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Create a Larascraper scraper (v2 or v3) for a target website, chaining browser actions (click, type, wait, scroll), conditional flow (when/repeatUntil), captcha solving, and file/PDF downloads. Detects the installed major and generates the matching style.
Add or edit a Laracrate file collection in config/laracrate.php with the correct anatomy (disk, access, types, variants, previews, extract/embed, flags, per-model scoping).
Runtime-verified Laravel inspection using the Laravel Boost MCP server (Tinker, Database Query/Schema, Last Error) instead of static grep. Falls back to Docker/Tinker if Boost is not installed.
Scaffold spatie/laravel-permission setup - add the HasRoles trait to a model and generate a roles & permissions seeder.
Audit spatie/laravel-permission usage - permissions used in code but undefined, defined but unused, unprotected routes, guard mismatches, and cache pitfalls.
Extract business logic from a controller or Livewire component method into a Laractions Action class.
| name | lc:migration-fresh-test |
| description | Run migrate:fresh in Docker and report errors with fix suggestions. |
| argument-hint | [analyze | fix | fix --dry-run | --seed] |
| user-invocable | true |
| allowed-tools | Read Grep Bash Edit Write Glob |
Run php artisan migrate:fresh inside the project's Docker container and provide detailed error analysis with fix suggestions when migrations fail.
| Subcommand | Description |
|---|---|
| (no argument) | Run migrate:fresh, report any errors with root cause analysis. |
fix | Run migrate:fresh and auto-fix each error encountered, with confirmation before each fix. Re-runs after each fix until all migrations pass. |
fix --dry-run | Run migrate:fresh, diagnose errors, show what fixes would be applied without changing anything. |
--seed | Run migrate:fresh --seed (can be combined with fix modes). |
Read to examine docker-compose.yml in the project root.app, laravel, or similar -- look for the service that mounts the application code and runs PHP).{project}_app or defined via container_name in docker-compose.yml.docker ps --filter name={container_name} --format '{{.Names}}' via Bash.docker compose up -d.Glob to look for database/schema/*.sql. If found, warn the user that schema dumps can cause migrations to be skipped (old migrations won't run, data imports may be lost). Ask if they want to remove the schema dump first.php -l on each migration file to catch parse errors before running the full migration. Use Bash:
docker exec {container} find /var/www/html/database/migrations -name "*.php" -exec php -l {} \;
If any syntax errors are found, report them immediately with file path and line number. Read the file to show the problematic code and suggest a fix. Stop here until syntax errors are resolved.docker exec {container} php artisan migrate:fresh--seed argument was provided, append --seed--force to bypass production checks2>&1 to capture both stdout and stderrBash with a generous timeout (migrations with data imports can take minutes).Report success with:
--seed was used, seeder resultsParse the error output to identify:
For each error, use Read to examine the failing migration and related files, then provide a diagnosis:
Foreign Key Constraint Failure
Cannot add foreign key constraint or SQLSTATE[HY000]: General error: 1215Table Already Exists
Table '{table}' already exists or SQLSTATE[42S01]Column Already Exists
Duplicate column name '{column}' or SQLSTATE[42S21]Unknown Column
Unknown column '{column}' or SQLSTATE[42S22]Data Type Mismatch
SQLSTATE[HY000]: General error: 3780 (referencing column type mismatch)unsignedBigInteger or foreignId)SQL Import Error
DB::unprepared() with large SQL filesClass Not Found
Class '{class}' not foundIn fix mode, after diagnosing each error:
Edit to apply the fix.migrate:fresh to verify the fix and catch the next error.In fix --dry-run mode, show all the same information but skip steps 4-7.
In default mode (no fix), show the diagnosis and suggested fix but do not apply.
PRE-FLIGHT CHECKS
==================
Schema dump: Not found (OK)
Syntax check: 85 migrations checked, 0 errors
MIGRATION RESULTS
==================
Status: FAILED
Failed at: 2025_05_14_214422_create_clients_table.php
Migrations completed before failure: 23/85
ERROR ANALYSIS
===============
Error: Cannot add foreign key constraint
SQL: ALTER TABLE `clients` ADD CONSTRAINT `clients_file_id_foreign` FOREIGN KEY (`file_id`) REFERENCES `files` (`id`)
Root Cause: The `files` table migration (2025_06_01_...) runs AFTER the `clients` table migration (2025_05_14_...).
SUGGESTED FIX
===============
Rename the files migration to run before clients:
From: 2025_06_01_000000_create_files_table.php
To: 2025_05_13_000000_create_files_table.php
Apply this fix? [Waiting for confirmation]