我有一张表,其主键用于多个其他表,并且有多个外键指向其他表。
CREATE TABLE location (
locationID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
...
) ENGINE = InnoDB;
CREATE TABLE assignment (
assignmentID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
locationID INT NOT NULL,
FOREIGN KEY locationIDX (locationID) REFERENCES location (locationID)
...
) ENGINE = InnoDB;
CREATE TABLE assignmentStuff (
...
assignmentID INT NOT NULL,
FOREIGN KEY assignmentIDX (assignmentID) REFERENCES assignment (assignmentID)
) ENGINE = InnoDB;
问题在于,当我试图删除其中一个外键列(即locationIDX)时,它会给出一个错误。
"ERROR 1025 (HY000): Error on rename"
如何在不出现此错误的情况下删除上面分配表中的列?