| Bug #57392 | Various relation of Inserts values in table options,cant be exported into Script | ||
|---|---|---|---|
| Submitted: | 12 Oct 2010 2:47 | Modified: | 13 Oct 2010 14:50 |
| Reporter: | Gerardo Palma | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Workbench: Modeling | Severity: | S3 (Non-critical) |
| Version: | 5.2.28 CE | OS: | Windows |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Inserted values model in related tables | ||
[12 Oct 2010 15:59]
Valeriy Kravchuk
Please, check if the same problem is repeatable with a newer version, 5.2.29. I can not repeat with 5.2.29 on Mac OS X.
[12 Oct 2010 18:08]
Gerardo Palma
I've updated to the last version 5.2.29 CE now and this until generates the same error.
[13 Oct 2010 3:07]
Valeriy Kravchuk
Please, upload .mwb file that demonstrates the problem.
[13 Oct 2010 14:50]
Gerardo Palma
Thanks, I've solved it. I've selected "Skip in SQL generation" option for a "Foreing key" to other table that is not Mandatory.

Description: I have set some values in "Inserts" table options, that have relations with other "Inserts" values into other table. When I want to export with "Forward Engineer SQL Create Script", this should generate the "Inserts statements" in order so that the values can be inserted. Example: CREATE TABLE IF NOT EXISTS `database`.`table1` ( `idtable1` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT NULL , `table2_idtable2` INT NOT NULL , PRIMARY KEY (`idtable1`) , CONSTRAINT `fk_table1_table2` FOREIGN KEY (`table2_idtable2` ) REFERENCES `database`.`table2` (`idtable2` ) ON DELETE RESTRICT ON UPDATE CASCADE, ) CREATE TABLE IF NOT EXISTS `database`.`table2` ( `idtable2` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT NULL , PRIMARY KEY (`idtable2`) ) -- the next sentences generates error -- INSERT INTO `database`.`table1` (`idtable1`, `name`, `idtable2`) VALUES (NULL, 'Value', 1); -- the table2 values must be inserted first -- INSERT INTO `database`.`table2` (`idtable2`, `name`) VALUES (1, 'Value'); How to repeat: Create two related tables with foreing key, and then insert values into the tables "Options->Inserts".