我有一个表,它的主键用于其他几个表,并且有几个外键到其他表。
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)时,它会给我一个错误。
“错误 1025 (HY000):重命名错误”
如何在不出现此错误的情况下删除上面分配表中的列?