错误:错误1005:无法创建表'cat10e.recording'(errno:150) [英] ERROR: Error 1005: Can't create table 'cat10e.recording' (errno: 150)
问题描述
我正在尝试转发具有7个表的数据仓库,但其中一个正在向我射击错误.我真的不知道该怎么做,因为它的设置方式与我的其他表格相同,因此我不确定是什么导致了该错误,并且google返回了各种各样的答案.相册SQL:pastebin.com/A3axVAA5
I'm trying to forward engineer my databae that has 7 tables but one is shooting me an error. I don't really know what to do from here because it is setup just like the rest of my tables so I'm unsure what is causing the error and google returns a multitude of varied answers. Album SQL: pastebin.com/A3axVAA5
Executing SQL script in server
ERROR: Error 1005: Can't create table 'cat10e.recording' (errno: 150)
CREATE TABLE IF NOT EXISTS `cat10e`.`recording` (
`rec_id` SMALLINT NOT NULL,
`album_id` INT NOT NULL,
`rec_duration` TIME NOT NULL,
`rec_genre` VARCHAR(45) NOT NULL,
`rec_cost` DECIMAL(4,2) NOT NULL,
`rec_title` VARCHAR(45) NOT NULL,
`rec_date` DATE NOT NULL,
`rec_note` VARCHAR(255) NULL,
PRIMARY KEY (`rec_id`, `album_id`),
INDEX `fk_recording_album1_idx` (`album_id` ASC),
CONSTRAINT `fk_recording_album1`
FOREIGN KEY (`album_id`)
REFERENCES `cat10e`.`album` (`album_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
SQL script execution finished: statements: 21 succeeded, 1 failed
Fetching back view definitions in final form.
Nothing to fetch
推荐答案
查看album
表的DDL,看起来album_id
列定义为:
Looking at the DDL for the album
table it looks like the album_id
column is defined as:
`album_id` SMALLINT NOT NULL
recording
表中的album_id
列定义为:
`album_id` INT NOT NULL
尝试将recording
表中的album_id
列更改为此:
Try changing the album_id
column in the recording
table to this:
`album_id` SMALLINT NOT NULL
如果要从recording
.album_id
到album
.album_id
!
这篇关于错误:错误1005:无法创建表'cat10e.recording'(errno:150)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!