Skip to content

v3.5.0 - Foreign key checks option

Choose a tag to compare

@tihomiro tihomiro released this 28 Jan 08:49
· 9 commits to master since this release

New Feature

  • --skip-fk-checks option: Disable foreign key checks during seeding. Useful for tables with FK constraints that would fail on delete/insert operations.

Usage

php artisan iseed users --skip-fk-checks

This generates:

\DB::statement('SET FOREIGN_KEY_CHECKS=0;');
\DB::table('users')->delete();
\DB::table('users')->insert(...);
\DB::statement('SET FOREIGN_KEY_CHECKS=1;');

Note: This generates MySQL-specific statements.

Thanks

Thanks to @aomini for PR #157.