1

I have added a foreign keys constraint in migration file for posts table to the user_id column. So, on delete user, I want to set the user_id column to null. So, I added this.

$table->foreign('user_id')
      ->references('id')
      ->on('users')
      ->onDelete('set null');

It is working on the MySQL database. But not working on SQLite PHPUnit test. I have enabled foreign key constraints for SQLite, but still not working.

Please guide How can I make it work?

gewode
  • 11
  • 1

0 Answers0