Laravel: Erro em php artisan db:seed | Fórum | School of Net

Deseja poder participar de nosso fórum e tirar todas as suas dúvidas?
Clique aqui e assine nosso plano de acesso ilimitado. Saiba mais.

por Gustavo

1 mês atrás Gustavo

Laravel: Erro em php artisan db:seed

Boa tarde, pessoal! Estou com um problema na minha aplicação, ao executar php artisan db:seed ``` Seeding: RolesTableSeeder Illuminate\Database\QueryException SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table referenced in a foreign key constraint (`velocms`.`role_user`, CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `velocms`.`roles` (`id`)) (SQL: truncate table `roles`) at C:\Gustavo\Clientes\Site\Site CMS\VeloCMS\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671 667| // If an exception occurs when attempting to run a query, we'll format the error 668| // message to include the bindings with SQL, which will make this exception a 669| // lot more helpful to the developer instead of just the database's errors. 670| catch (Exception $e) { > 671| throw new QueryException( 672| $query, $this->prepareBindings($bindings), $e 673| ); 674| } 675| 1 C:\Gustavo\Clientes\Site\Site CMS\VeloCMS\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table referenced in a foreign key constraint (`velocms`.`role_user`, CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `velocms`.`roles` (`id`))") 2 C:\Gustavo\Clientes\Site\Site CMS\VeloCMS\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464 PDOStatement::execute() ```

9 Respostas