0
我试图删除表中的一个外键列,我已命名为ProductInvoice。我试图删除的列名为PersonID,来自表Person。当我运行查询错误1025 Err 150在MySql
ALTER TABLE ProductInvoice
DROP COLUMN PersonID;
我得到这个错误...
Error Code: 1025. Error on rename of './jkripal/#sql-91c_19ff0' to './jkripal/ProductInvoice' (errno: 150)
上的任何意见如何排查呢?我浏览过这个网站,找不到任何有帮助的答案。
我也尝试过这些查询
ALTER TABLE ProductInvoice DROP FOREIGN KEY `fkPerson`;
ALTER TABLE ProductInvoice DROP COLUMN PersonID;
并接收该响应...
Error Code: 1025. Error on rename of './jkripal/ProductInvoice' to './jkripal/#sql2-91c-1a05a' (errno: 152)
这些是SHOW结果CREATE TABLE ProductInvoice
'ProductInvoice', 'CREATE TABLE `ProductInvoice`
(\n `ProductInvoiceID` int(11) NOT NULL AUTO_INCREMENT,
\n `PersonID` int(11) DEFAULT NULL,
\n `ProductID` int(11) NOT NULL,
\n `InvoiceID` int(11) NOT NULL,
\n `TravelDate` varchar(255) DEFAULT NULL,
\n `TicketNote` varchar(255) DEFAULT NULL,
\n `Quantity` int(11) DEFAULT NULL,
\n `InsuranceTicketCode` varchar(255) DEFAULT NULL,
\n PRIMARY KEY (`ProductInvoiceID`),
\n KEY `fkPerson` (`PersonID`),
\n KEY `fk_ProductInvoice_to_Product` (`ProductID`),
\n KEY `fk_ProductInvoice_to_Invoice` (`InvoiceID`),
\n CONSTRAINT `ProductInvoice_ibfk_1` FOREIGN KEY (`PersonID`) REFERENCES `Person` (`PersonID`),
\n CONSTRAINT `ProductInvoice_ibfk_2` FOREIGN KEY (`ProductID`) REFERENCES `Product` (`ProductID`),
\n CONSTRAINT `ProductInvoice_ibfk_3` FOREIGN KEY (`InvoiceID`) REFERENCES `Invoice` (`InvoiceID`)
\n) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8'
我也曾尝试这无济于事
ALTER TABLE ProductInvoice DROP FOREIGN KEY `fkPerson`;
DROP INDEX `fkPerson` ON ProductInvoice;
ALTER TABLE ProductInvoice DROP COLUMN PersonID;