I need to drop a constraint from a table. The basic structure is this:
Code:
ParentTable (
ParentID INT,
ParentName TINYTEXT
);
ChildTable (
ChildID,
ParentID,
ChildName TINYTEXT,
INDEX(ParentID),
CONSTRAINT ParentTable_ParentID_fk FOREIGN KEY (ParentID) REFERENCES ParentTable(ParentID)
);
Basically, I need to drop the constraint that
ChildTable has to
ParentTable.
I've tried these commands in pretty well every order I can think of:
Code:
ALTER TABLE ChildTable DROP FOREIGN KEY ParentTable_ParentID_fk;
ALTER TABLE ChildTable DROP INDEX ParentID;
ALTER TABLE ChildTable DROP COLUMN ParentID;
And they produce these errors, respectively (regardless of order):
Code:
ERROR 1005: Can't create table <oldtable> to <newtable>
ERROR 1025: Error on rename of <oldtable> to <newtable>
ERROR 1025: Error on rename of <oldtable> to <newtable>
Dropping the tables and re-inserting the data is NOT an option as this is for a large site that is storing a substantial amount of data.