1
resposta

Erro no php artisan migrate

Olá professor, estou tentando rodar o migrate para criar as tabelas do meu banco, mas está me retornando este erro:

iMac-de-Leandro-2:controlador-series le_system_182$ php artisan migrate
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table
Migrating: 2019_03_23_161139_criar_tabela_series
Migrated:  2019_03_23_161139_criar_tabela_series
Migrating: 2019_03_23_185334_create_temporadas_table

   Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `temporadas` add constraint `temporadas_serie_id_foreign` foreign key (`serie_id`) references `series` (`id`))

  at /Users/le_system_182/Documents/www/controlador-series/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668| 

  Exception trace:

  1   PDOException::("SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint")
      /Users/le_system_182/Documents/www/controlador-series/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

  2   PDOStatement::execute()
      /Users/le_system_182/Documents/www/controlador-series/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

  Please use the argument -v to see more details.
iMac-de-Leandro-2:controlador-series le_system_182$ 

O que acha que pode ser?

1 resposta

Já consegui resolver!!! :D