medoo

Is there a way to disable foreign key checks? -Medoo


I am trying to remove some rows in my tables that are constrained by foreign keys. Is there a way to disable foreign key checks to allow the deletion of these items? Possibly through Medoo::raw() ?


Solution

  • Foreign keys can be disabled by putting $database->query('SET FOREIGN_KEY_CHECKS = 0'); before your normal Medoo statement. Don't forget to run $database->query('SET FOREIGN_KEY_CHECKS = 1'); after you are finished with the need to disable.