CAP.L0.MIGRATE_ERROR — Error during the real shadow migrate
- Category: safety
- Level: 0
- Stability: stable
- Suites: lint
The migration failed while it was being run for real against the throwaway shadow database. This is the shadow counterpart to CAP.L0.PRETEND_ERROR, and it is the whole reason the truth mode earns its cost: pretend mode never executes, so a migration that only fails on real data or real state — a unique constraint over existing duplicates, a NOT NULL column added to a populated table — passes pretend and then blows up in production. Shadow mode runs it for real and catches that.
The finding carries the driver's own SQLSTATE and message (with any absolute path relativized, so the same error reads identically on every machine, and with connection credentials redacted, so a host, user, or password never appears). It never carries a stack trace. Fix the error the migration raises and re-run.
The migration that failed carries this finding; every migration after it in the run is reported as undetermined (shadow_migrate_failed), because the database is in a partial state and running on top of it would fail or lint against a schema that never really formed — not a pass, and not silently empty.
Flagged
public function up(): void
{
// Passes pretend (nothing runs) but fails the real migrate when the
// column already holds duplicates — the unique violation only exists
// against real data, which is exactly what shadow mode sees.
Schema::table('users', fn (Blueprint $table) => $table->unique('email'));
}
Preferred
public function up(): void
{
Schema::create('sessions', function (Blueprint $table): void {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable();
});
}