Error ao gerar
Estou com erro ao tentar gerar
php artisan migrate:refresh --seed
Illuminate\Database\QueryException : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Businers' for key 'plans_name_unique' (SQL: insert into `plans` (`name`, `url`, `price`, `description`, `updated_at`, `created_at`) values (Businers, businers, 499.99, Plano Empresarial, 2021-05-31 12:03:13, 2021-05-31 12:03:13))
at C:\larafood\vendor\laravel\framework\src\Illuminate\Database\Connection.php:669
665| // If an exception occurs when attempting to run a query, we'll format the error
666| // message to include the bindings with SQL, which will make this exception a
667| // lot more helpful to the developer instead of just the database's errors.
668| catch (Exception $e) {
> 669| throw new QueryException(
Olá, Thiago!
Tudo bem?
Tem o projeto no GitHub?
Quero ver como está os seus arquivos de migration.
Roda esse comando:
php artisa migrate:fresh --seed
Não deu erro, porem também não criou os seeds.
PS C:\larafood> php artisan migrate:fresh --seed
Dropped all tables successfully.
Migration table created successfully.
Migrating: 2014_05_11_131051_create_plans_table
Migrated: 2014_05_11_131051_create_plans_table (0.15 seconds)
Migrating: 2014_05_27_134414_create_tenants_table
Migrated: 2014_05_27_134414_create_tenants_table (0.25 seconds)
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (0.11 seconds)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (0.08 seconds)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated: 2019_08_19_000000_create_failed_jobs_table (0.03 seconds)
Migrating: 2021_05_17_142027_create_detail_plans_table
Migrated: 2021_05_17_142027_create_detail_plans_table (0.09 seconds)
Migrating: 2021_05_18_202256_create_profiles_table
Migrated: 2021_05_18_202256_create_profiles_table (0.05 seconds)
Migrating: 2021_05_22_104955_create_permissions_table
Migrated: 2021_05_22_104955_create_permissions_table (0.05 seconds)
Migrating: 2021_05_22_121751_create_permission_profile_table
Migrated: 2021_05_22_121751_create_permission_profile_table (0.15 seconds)
Migrating: 2021_05_26_133730_create_plan_profile_table
Migrated: 2021_05_26_133730_create_plan_profile_table (0.16 seconds)
Database seeding completed successfully.
PS C:\larafood>
Tem o projeto no GitHub? Posso dá uma olhada para você amigo.
Não roda nem com esse comando?
php artisan db:seed
Não funciona também.
Segue o link do github.
https://github.com/thiagoplanet/larafood
Lá no seu DatabaseSeeder no método call, passe um array e tente novamente:
$this->call([
PlansTableSeeder::class,
TenantsTableSeeder::class,
UsersTableSeeder::class
]);
Precisa estar logado para conseguir responder a este ticket!
Clique Aqui Para Entrar!