-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Closed
Labels
Description
- Laravel Version: 5.8
- PHP Version: 7.3
- Database Driver & Version: Postgres 10
Description:
I believe this is something specific with Postgres
I am trying to truncate a table using Model::truncate() which of course truncates the table, and deletes all the foreign keyed records in the other tables. Even though ON DELETE CASCADE is not specified.
Tried to truncate the table within Schema::disableForeignKeyConstraints() & Schema::enableForeignKeyConstraints() statements. Still it clears all the records related via any foreign key. No exceptions or any warnings also.
Eg: truncating (temporarily) currency table will clear all the records in the products table 🥶
Is this an expected behaviour? it was not the case with MySQL. Mysql triggered errors when the FK constraints are active. And it didn't delete FK records
blakethepatton, alright, scottxhe and apacoder