Bug #20991 Making foreign keys using the 1tomany tool
Submitted: 12 Jul 2006 9:52 Modified: 21 Jul 2006 8:10
Reporter: Steve Pratt Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench Preview Severity:S3 (Non-critical)
Version:1.1.1 alpha OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[12 Jul 2006 9:52] Steve Pratt
Description:
When using the foriegn key tool to link tables, the foriegn key gets created but the row type is not updated.

How to repeat:
Model two tables, and link using the 1tomany foreign key tool, obviously the e tables must have at least 1 primary key. 

Suggested fix:
manually edit the rows to include the types. This corrects the scipt output.
[14 Jul 2006 12:23] Tonci Grgin
Hi Steve and thanks for your problem report.
Can you please tell me where did you download this version from? Current beta is 1.0.6 on http://dev.mysql.com/downloads/workbench/1.0.html. Can you repeat described behavior on that version?
[14 Jul 2006 13:56] Tonci Grgin
Steve, I'd still like to see the URL...
As for your report it is quite unclear to me. 
My test case is:
  Two identical tables, PK on int unsigned AI column and a varchar column.
  Link them 1 > m
  Destination table Foreign keys tab, Column and Refered column fields are empty until clicked into with no effect on validity of generated SQL script (it works).
However, neither of the table varchar columns did pull charset/collation from database/table defaults thus SQL script failed on "`textcol_table_0X` VARCHAR(45) CHARACTER SET  COLLATE  NULL,":
-- ----------------------------------------------------------------------
-- MySQL GRT Application
-- SQL Script
-- ----------------------------------------------------------------------

SET FOREIGN_KEY_CHECKS = 0;

CREATE DATABASE IF NOT EXISTS `test`
  CHARACTER SET latin1;
-- -------------------------------------
-- Tables

DROP TABLE IF EXISTS `test`.`table_01`;
CREATE TABLE `test`.`table_01` (
  `idtable_01` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `textcol_table_01` VARCHAR(45) CHARACTER SET  COLLATE  NULL,
  PRIMARY KEY (`idtable_01`)
)
ENGINE = InnoDB
CHARACTER SET latin1 COLLATE latin1_swedish_ci;

DROP TABLE IF EXISTS `test`.`table_02`;
CREATE TABLE `test`.`table_02` (
  `idtable_02` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `textcol_table_02` VARCHAR(45) CHARACTER SET  COLLATE  NULL,
  PRIMARY KEY (`idtable_02`),
  CONSTRAINT `FKtable_01` FOREIGN KEY `FKtable_01` (`idtable_02`)
    REFERENCES `test`.`table_01` (`idtable_01`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT
)
ENGINE = InnoDB
CHARACTER SET latin1 COLLATE latin1_swedish_ci;

SET FOREIGN_KEY_CHECKS = 1;

-- ----------------------------------------------------------------------
-- EOF
but I wont call it a bug...

Am I missing something here?
[17 Jul 2006 12:41] Tonci Grgin
Steve, I've downloaded the version in question but still don't follow you. Can you make a simple test project and attach it together with SQL script, pictures etc. to this report marking wrong parts?
[20 Jul 2006 19:01] MySQL Verification Team
I have also tried to replicate your situation. However, I cannot follow your instructions to recreate either the tables as shown in your screen shots, the relationship as shown in your screen shots, or the error as you describe it. 

Can you provide a simple walk-through script for the exact sequence of actions to perform?
[20 Jul 2006 23:10] MySQL Verification Team
Thank you for the feedback. Sorry but I was unable to repeat the behavior
reported, it is possible for you to attach the file of a small project which
shows that issue?

Thanks in advance.