我得到一个
“无法添加或更新子行:外键约束失败 (
smarturbia
.pois
, CONSTRAINTfk_pois_cities1
FOREIGN KEY (city
) REFERENCEScities
(id
) ON DELETE NO ACTION ON UPDATE NO ACTION) (1509)”
我不知道为什么。
我的表是通过 Mysql 工作台 5.2 生成的,如果您需要其余的表,请告诉我:
-- -----------------------------------------------------
-- Table `smarturbia`.`cities`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `smarturbia`.`cities` ;
CREATE TABLE IF NOT EXISTS `smarturbia`.`cities` (
`id` BIGINT(11) NOT NULL AUTO_INCREMENT ,
`published` VARCHAR(1) NOT NULL DEFAULT '0' ,
`open` VARCHAR(1) NOT NULL DEFAULT '0' ,
`path` VARCHAR(25) NOT NULL DEFAULT 'taxi' ,
`key` VARCHAR(50) NOT NULL ,
`world` VARCHAR(10) NOT NULL DEFAULT 'earth' ,
`name` VARCHAR(50) NOT NULL ,
`description` VARCHAR(250) NULL DEFAULT NULL ,
`logo` VARCHAR(250) NULL DEFAULT NULL ,
`footer` VARCHAR(250) NOT NULL DEFAULT '/taxi/assets/img/taxi_smarturbia_image_default.png' ,
`footer_large` VARCHAR(250) NOT NULL ,
`leftpub` VARCHAR(50) NOT NULL ,
`rightpub` VARCHAR(50) NOT NULL ,
`model` VARCHAR(250) NOT NULL ,
`modelxscale` FLOAT NULL DEFAULT '1' ,
`modelyscale` FLOAT NULL DEFAULT '1' ,
`modelzscale` FLOAT NULL DEFAULT '1' ,
`wheelmodelxscale` FLOAT NULL DEFAULT '1' ,
`wheelmodelyscale` FLOAT NULL DEFAULT '1' ,
`wheelmodelzscale` FLOAT NULL DEFAULT '1' ,
`allwheels` VARCHAR(250) NULL DEFAULT NULL ,
`frontleftwheel` VARCHAR(250) NULL DEFAULT NULL ,
`frontrightwheel` VARCHAR(250) NULL DEFAULT NULL ,
`rearleftwheel` VARCHAR(250) NULL DEFAULT NULL ,
`rearrightwheel` VARCHAR(250) NULL DEFAULT NULL ,
`axisdistance` FLOAT NOT NULL DEFAULT '2.5' ,
`wheelsdistance` FLOAT NULL DEFAULT '1' ,
`wheelsheight` FLOAT NULL DEFAULT '1' ,
`kms` FLOAT NULL DEFAULT '0' ,
`maxspeed` FLOAT NULL DEFAULT '160' ,
`accel` FLOAT NULL DEFAULT '25' ,
`accelstep` FLOAT NULL DEFAULT '25' ,
`minaccelstep` FLOAT NULL DEFAULT '5' ,
`maxrevspeed` FLOAT NULL DEFAULT '30' ,
`decel` FLOAT NULL DEFAULT '90' ,
`gravity` FLOAT NULL DEFAULT '70' ,
`camheight` FLOAT NULL DEFAULT '5' ,
`camtilt` FLOAT NULL DEFAULT '90' ,
`traildistance` FLOAT NULL DEFAULT '15' ,
`mass` FLOAT NULL DEFAULT '3000' ,
`vehicleagility` FLOAT NULL DEFAULT '0.0005' ,
`suspensionstiffness` FLOAT NULL DEFAULT '0.5' ,
`suspensionrestlength` FLOAT NULL DEFAULT '0.5' ,
`suspensiondamping` FLOAT NULL DEFAULT '-0.15' ,
`suspensiondeltatime` FLOAT NULL DEFAULT '0.25' ,
`turnspeedmin` FLOAT NULL DEFAULT '20' ,
`turnspeedmax` FLOAT NULL DEFAULT '60' ,
`speedmaxturn` FLOAT NULL DEFAULT '5' ,
`speedminturn` FLOAT NULL DEFAULT '50' ,
`steerroll` FLOAT NULL DEFAULT '-1' ,
`rollspring` FLOAT NULL DEFAULT '0.5' ,
`rollclamp` FLOAT NULL DEFAULT '50' ,
`mapiconurl` VARCHAR(250) NULL DEFAULT NULL ,
`vehicleshadow` VARCHAR(250) NULL DEFAULT NULL ,
`vehiclesound` VARCHAR(250) NULL DEFAULT NULL ,
`vehiclesoundtime` FLOAT NULL DEFAULT '150' ,
`vehiclefastsound` VARCHAR(250) NULL DEFAULT NULL ,
`vehiclefastsoundtime` FLOAT NULL DEFAULT '150' ,
`backgroundsound` VARCHAR(250) NULL DEFAULT NULL ,
`backgroundsoundtime` FLOAT NULL DEFAULT '150' ,
`crashsound` VARCHAR(250) NULL DEFAULT NULL ,
`crashsoundtime` FLOAT NULL DEFAULT '150' ,
`vehicletype` VARCHAR(50) NULL DEFAULT 'car' ,
`date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY (`id`) ,
INDEX `key` (`key` ASC) )
ENGINE = InnoDB
AUTO_INCREMENT = 153
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `smarturbia`.`pois`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `smarturbia`.`pois` ;
CREATE TABLE IF NOT EXISTS `smarturbia`.`pois` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT ,
`city` BIGINT(11) NOT NULL ,
`name` VARCHAR(50) NOT NULL ,
`description` VARCHAR(250) NOT NULL ,
`lat` DOUBLE NOT NULL ,
`lon` DOUBLE NOT NULL ,
`heading` FLOAT NULL DEFAULT '0' ,
PRIMARY KEY (`id`) ,
INDEX `fk_pois_cities1_idx` (`city` ASC) ,
CONSTRAINT `fk_pois_cities1`
FOREIGN KEY (`city` )
REFERENCES `smarturbia`.`cities` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 408
DEFAULT CHARACTER SET = latin1;