I have a table whose primary key is used in several other tables and has several foreign keys to other tables.
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;
The problem is that when I'm trying to drop one of the foreign key columns (ie locationIDX) it gives me an error.
"ERROR 1025 (HY000): Error on rename"
How can I drop the column in the assignment table above without getting this error?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…