实际上我使用这个 sql 脚本在 mysql 5.0.24 上创建表方案,它工作正常,问题是当我在 mysql 5.5.16 上尝试相同的脚本时,我收到以下错误消息:
来自服务器的一般错误消息:“无法创建表 'amdb.am_wta_methodtree' (errno: 150)”
这是我的sql:
create table AM_WTA_MethodInstance(
"ID" BIGINT NOT NULL,
"TRANSACTIONID" BIGINT NOT NULL,
"INVOCATIONTIME" BIGINT NOT NULL,
"METHODIDENTIFIERID" BIGINT NOT NULL,
"THREADID" VARCHAR(255) NOT NULL,
"INCLUSIVETIME" BIGINT NOT NULL DEFAULT 0,
"EXCLUSIVETIME" BIGINT NOT NULL DEFAULT 0,
"STATUS" INTEGER(1) NOT NULL DEFAULT 0,
"EXCEPTIONMESSAGE" TEXT,
PRIMARY KEY ("ID"),
FOREIGN KEY(METHODIDENTIFIERID) REFERENCES AM_WTA_MethodIdentifier(ID),
FOREIGN KEY(TRANSACTIONID) REFERENCES AM_WTA_Transaction(TRANSACTIONID) ON DELETE CASCADE)
create table AM_WTA_MethodTree(
"PARENTID" BIGINT NOT NULL,
"CHILDID" BIGINT NOT NULL,
"INVOCATIONTIME" BIGINT NOT NULL,
PRIMARY KEY ("PARENTID","CHILDID"),
FOREIGN KEY(PARENTID,CHILDID) REFERENCES AM_WTA_MethodInstance(ID,ID) ON DELETE CASCADE)