22/07/2011, 17:32
|
| | Fecha de Ingreso: agosto-2009
Mensajes: 247
Antigüedad: 15 años, 3 meses Puntos: 10 | |
Error en CREATE TABLE con FK Buenas........ tengo un problema con la generacion de tablas con claves foraneas: Cita: CREATE TABLE IF NOT EXISTS `mydb`.`reviews` (
`id_review` INT(11) NOT NULL AUTO_INCREMENT ,
`id_user_blogger` INT(11) NULL DEFAULT NULL ,
`id_user_reviewer` INT(11) NULL DEFAULT NULL ,
`id_assignament` INT(11) NOT NULL ,
`title` VARCHAR(45) NOT NULL ,
`body` VARCHAR(45) NOT NULL ,
`keywords` VARCHAR(45) NOT NULL ,
`date_submision_by_sponsor` DATETIME NULL DEFAULT NULL ,
`date_assign` DATETIME NULL DEFAULT NULL ,
`date_submision_by_blogger` VARCHAR(45) NULL DEFAULT NULL ,
`date_review` DATETIME NULL DEFAULT NULL ,
`aproval` TINYINT(1) NOT NULL DEFAULT 0 ,
`date_system` DATETIME NOT NULL ,
PRIMARY KEY (`id_review`) ,
INDEX `fk_reviews_users2` (`id_user_blogger` ASC) ,
INDEX `fk_reviews_users3` (`id_user_reviewer` ASC) ,
INDEX `fk_reviews_assignaments1` (`id_assignament` ASC) ,
CONSTRAINT `fk_reviews_users2`
FOREIGN KEY (`id_user_blogger` )
REFERENCES `mydb`.`users` (`id_user` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_reviews_users3`
FOREIGN KEY (`id_user_reviewer` )
REFERENCES `mydb`.`users` (`id_user` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_reviews_assignaments1`
FOREIGN KEY (`id_assignament` )
REFERENCES `mydb`.`assignaments` (`id_assignament` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
COMMENT = 'los articulos'; Asi como lo genera MySQL WORKBENCH da error....... y se que son las claves foraneas el problema porque cuando las quito ... no hay error: Cita: CREATE TABLE IF NOT EXISTS `mydb`.`reviews` (
`id_review` INT(11) NOT NULL AUTO_INCREMENT ,
`id_user_blogger` INT(11) NULL DEFAULT NULL ,
`id_user_reviewer` INT(11) NULL DEFAULT NULL ,
`id_assignament` INT(11) NOT NULL ,
`title` VARCHAR(45) NOT NULL ,
`body` VARCHAR(45) NOT NULL ,
`keywords` VARCHAR(45) NOT NULL ,
`date_submision_by_sponsor` DATETIME NULL DEFAULT NULL ,
`date_assign` DATETIME NULL DEFAULT NULL ,
`date_submision_by_blogger` VARCHAR(45) NULL DEFAULT NULL ,
`date_review` DATETIME NULL DEFAULT NULL ,
`aproval` TINYINT(1) NOT NULL DEFAULT 0 ,
`date_system` DATETIME NOT NULL ,
PRIMARY KEY (`id_review`) ,
INDEX `fk_reviews_users2` (`id_user_blogger` ASC) ,
INDEX `fk_reviews_users3` (`id_user_reviewer` ASC) ,
INDEX `fk_reviews_assignaments1` (`id_assignament` ASC)
) ENGINE = INNODB DEFAULT CHARACTER SET = utf8 COMMENT = ''; Idea de que esta mal ?
GRACIAS!
__________________ The best powerful search engine for MSN messenger profiles I know is msn profile viewer. It's really good either if you have an e-mail address or not. Try it! |