Vigyata.AI
Is this your channel?
GithubGithub00

08 Add withoutForeignKeyConstraints() to disable foreign key constraints in a callback

This PR is where withoutForeignKeyConstraints() was added, and it’s a really clean improvement for schema operations. I like it because I can wrap my drop or other schema changes in a callback and Laravel automatically handles disabling and enabling constraints.

Buy on Github

You'll be taken to Github to complete your purchase.

Pros

  • +Cleaner than manually disabling/enabling constraints
  • +Reduces chances of forgetting to re-enable constraints

Cons

  • -You still need to be careful when bypassing constraints in destructive operations

Featured in this video