Workbench export : constraints error
Hello !
I try to run this code created with a MySQL Workbench export
CREATE TABLE IF NOT EXISTS `SuperGESTION`.`Groupes` (
`idGroupes` SMALLINT NOT NULL AUTO_INCREMENT ,
`Nom` VARCHAR(32) NULL DEFAULT 'NC' ,
PRIMARY KEY (`idGroupes`) )
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `SuperGESTION`.`CodePostaux` (
`idCP` MEDIUMINT UNSIGNED NOT NULL ,
`Ville` VARCHAR(32) NULL ,
`Ext` TINYINT UNSIGNED NULL DEFAULT 1 ,
PRIMARY KEY (`idCP`) )
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `SuperGESTION`.`Famille` (
`idFamille` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT ,
`idGroupes` SMALLINT NULL ,
`Adresse` VARCHAR(45) NULL DEFAULT 'NC' ,
`idCP` TINYINT UNSIGNED NULL ,
PRIMARY KEY (`idFamille`) ,
INDEX `GroupesLink` (`idGroupes` ASC) ,
INDEX `CPLink` (`idCP` ASC) ,
CONSTRAINT `GroupesLink`
FOREIGN KEY (`idGroupes` )
REFERENCES `SuperGESTION`.`Groupes` (`idGroupes` )
ON DELETE SET NULL
ON UPDATE CASCADE,
CONSTRAINT `CPLink`
FOREIGN KEY (`idCP` )
REFERENCES `SuperGESTION`.`CodePostaux` (`idCP` )
ON DELETE SET NULL
ON UPDATE CASCADE)
ENGINE = InnoDB;
but when i execute it, i got a ERRNO 150 because of the CONSTRAINT part
of the code (if i just delete all the Constraint part, the code runs ok)
if you got any ideas (Exporting parameters on Workbench, or Importing params in MySQL) it would be great !
MySQL Workbench OSS 5.0.29 Community
MySQL Server : 5.1.30-community
Thanks a lot
Thomas