PostgreSQL truncate in DB:Seed Hi,
I'm working on a project right now using PostgreSQL. in my seeder, I truncated my table including those who have a foreign key constraint. I tried to use this
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
but it triggers an error.
[Illuminate\Database\QueryException]
SQLSTATE[42704]: Undefined object: 7 ERROR: unrecognized configuration parameter "foreign_key_checks" (SQL: SET FOREIGN
_KEY_CHECKS=0;)
What should be the equivalent FOREIGN_KEY_CHECK in PostgreSQL?
Thanks,
Hi @Mittensoff , Thanks for your response. I figured out how I truncate my table in PostgreSQL by using this code snippet.
DB::statement("TRUNCATE TABLE {$table} RESTART IDENTITY CASCADE");
Please sign in or create an account to participate in this conversation.