Skip to content

Commit

Permalink
feat: Disable Foreign before running seeders
Browse files Browse the repository at this point in the history
Modified DatabaseSeeder.php to temporarily disable
foreign key checksbefore truncating tables, ensuring
smooth database seeding without constraint violations.

Fixes hngprojects#626
  • Loading branch information
idehen-divine committed Mar 2, 2025
1 parent 307820c commit b694c39
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
// Disable foreign key checks
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
//create an admin user
$this->call([
AdminSeeder::class
Expand Down

0 comments on commit b694c39

Please sign in to comment.