Bug #35180 No constraints checks during the generated script
Submitted: 10 Mar 2008 12:50 Modified: 28 Aug 2009 12:20
Reporter: moi meme Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S4 (Feature request)
Version:5.0.14b OS:Any
Assigned to: Alexander Musienko CPU Architecture:Any
Tags: Checks, foreign, script, unique

[10 Mar 2008 12:50] moi meme
Description:
On the beginning of a script generated by Workbench, there is these lines:

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

Why are these lines here ?
If i make some inserts in my tables in workbench, and that a foreign key rule is not validated, the database creation script generated by Workbench will be incoherent.

Would it be possible to change these values with a script generation option ?

How to repeat:
Create a table T1 with an attribute A1
Create a table T2 with an attribute A2 link with A1
Insert in T1 value (1)
Insert in T2 value (2)
Workbench won't warn you that something is wrong
If you generate the database creation script, since there is the flag 
 "FOREIGN_KEY_CHECKS=0", this error will be committed into database !
[14 Mar 2008 5:41] Valeriy Kravchuk
Thank you for a problem report.
[30 Jul 2009 23:02] Alfredo Kojima
Foreign key checks should be enabled before the standard inserts section of the script starts.
[14 Aug 2009 14:30] Johannes Taxacher
has been changed accordingly. this option is now triggered before insert-statements.
fixed in 5.1.17
[28 Aug 2009 12:20] Tony Bedford
An entry has been added to the 5.1.17 changelog:

Foreign Key checks were not enabled before the standard inserts section of the script started.