Re: Workbench export : constraints error
Sure, i used it, sorry i didn't write the complet instruction,
here it is, with the same error.
the code (down there) returns
ERROR 1005 (HY000): Can't create table 'supergestion.famille' (errno: 150)
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `SuperGESTION` ;
SHOW WARNINGS;
USE `SuperGESTION`;
CREATE TABLE IF NOT EXISTS `SuperGESTION`.`Groupes` (
`idGroupes` SMALLINT NOT NULL AUTO_INCREMENT ,
`Nom` VARCHAR(32) NULL DEFAULT 'NC' ,
PRIMARY KEY (`idGroupes`) )
ENGINE = InnoDB;
SHOW WARNINGS;
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;
SHOW WARNINGS;
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 ,
`Email` VARCHAR(45) NULL ,
`QF` SMALLINT UNSIGNED NULL ,
`CCAS` TINYINT UNSIGNED NULL DEFAULT 0 ,
`FAS` TINYINT UNSIGNED NULL DEFAULT 0 ,
`BV` TINYINT UNSIGNED NULL DEFAULT 0 ,
`DateCotisation` DATE 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;
SHOW WARNINGS;