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?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire