claude-code - 💡(How to fix) Fix [BUG] REPORTE DE ERROR: Ejecución de migrate:fresh sin Confirmación Versión: Claude Code 2.1.100 Fecha: 2026-04-10 Severidad: CRÍTICA [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46252Fetched 2026-04-11 06:25:13
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×6commented ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Detalles

Comando ejecutado sin confirmación:

php artisan migrate:fresh --seed

Resultado:

  • Perdida TOTAL de datos de desarrollo
  • Varias horas de trabajo perdidas
  • Necesidad de recrear desde cero

Por Qué Es Crítico

  1. Comando destructivo: migrate:fresh borra TODAS las tablas
  2. Sin confirmación: No preguntó al usuario
  3. Sin advertencia: No explicó las consecuencias antes
  4. Repetido: Pasó DOS VECES en la misma sesión
  5. Sin reversión: Los datos no se recuperan automáticamente

What Should Happen?

Se necesita:

  • ✅ Validación: Detectar si la BD tiene datos antes de migrate:fresh
  • ✅ Confirmación explícita: Pedir permiso directo del usuario
  • ✅ Advertencia clara: Mostrar que borra TODOS los datos
  • ✅ Bloqueo automático: Impedir migrate:fresh en BD con datos sin confirmación

Error Messages/Logs

Steps to Reproduce

La tarea era cargar países en tabla countries. El asistente debería haber usado: php artisan db:seed --class=CountriesSeeder # ✅ CORRECTO

En lugar de: php artisan migrate:fresh --seed # ❌ INCORRECTO

Claude Model

Other

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.100

Platform

Other

Operating System

Other Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

Contexto

La tarea era cargar países en tabla countries. El asistente debería haber usado: php artisan db:seed --class=CountriesSeeder # ✅ CORRECTO

En lugar de: php artisan migrate:fresh --seed # ❌ INCORRECTO

extent analysis

TL;DR

To prevent data loss, add a confirmation prompt before executing the migrate:fresh command, especially when the database contains existing data.

Guidance

  • Modify the migrate:fresh command to detect if the database has existing data and prompt the user for confirmation before proceeding.
  • Implement a warning message that clearly explains the consequences of running migrate:fresh, including the loss of all data.
  • Consider adding an automatic block to prevent migrate:fresh from running on a database with existing data without user confirmation.
  • Use the correct command php artisan db:seed --class=CountriesSeeder to seed the database instead of php artisan migrate:fresh --seed.

Example

// Pseudo-code example of a confirmation prompt
if (DB::hasExistingData()) {
    echo "Warning: This command will delete all data in the database. Are you sure you want to proceed? (yes/no)";
    $response = readline();
    if (strtolower($response) !== 'yes') {
        exit;
    }
}

Notes

The provided solution is a general guidance and may require modifications to fit the specific use case and implementation.

Recommendation

Apply a workaround by using the correct seeding command and consider modifying the migrate:fresh command to include a confirmation prompt to prevent accidental data loss.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING