el error lo da al intentar crear la tabla stores, la tabla users la crea sin problemas, solo la pongo para que vean la relación
Código:
Aqui la consulta de creacion de las tablas users y stores:ERROR: Error 1005: Can't create table 'tientas.stores' (errno: 121)
Esta es de users:
Código:
-- Table `tientas`.`users` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tientas`.`users` ( `id` INT NOT NULL AUTO_INCREMENT , `username` VARCHAR(45) NOT NULL , `password` VARCHAR(45) NOT NULL , `phone` VARCHAR(45) NOT NULL , `email` VARCHAR(45) NOT NULL , `address` VARCHAR(150) NOT NULL , `picture` VARCHAR(200) NULL , `active` TINYINT(1) NOT NULL , `group_id` INT NOT NULL , `regione_id` INT NOT NULL , `created` DATETIME NOT NULL , `modified` DATETIME NOT NULL , PRIMARY KEY (`id`) , INDEX `group_id` (`group_id` ASC) , INDEX `regione_id` (`regione_id` ASC) , CONSTRAINT `group_id` FOREIGN KEY (`group_id` ) REFERENCES `tientas`.`groups` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `regione_id` FOREIGN KEY (`regione_id` ) REFERENCES `tientas`.`regiones` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_spanish_ci;
Y esta es la de stores:
Código:
-- ----------------------------------------------------- -- Table `tientas`.`stores` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tientas`.`stores` ( `id` INT NOT NULL AUTO_INCREMENT , `user_id` INT NOT NULL , `name` VARCHAR(45) NOT NULL , `category` VARCHAR(45) NOT NULL , `category_id` INT NOT NULL , `created` DATETIME NOT NULL , `modified` DATETIME NOT NULL , PRIMARY KEY (`id`) , INDEX `user_id` (`user_id` ASC) , INDEX `category_id` (`category_id` ASC) , CONSTRAINT `user_id` FOREIGN KEY (`user_id` ) REFERENCES `tientas`.`users` (`id` ) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `category_id` FOREIGN KEY (`category_id` ) REFERENCES `tientas`.`categorys` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_spanish_ci;
Que podra ser?