我有一个具有以下结构的表:
CREATE TABLE `Lm_help` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`section` int(10) NOT NULL,
`language` int(10) NOT NULL,
`title` varchar(255) NOT NULL,
`text` text NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_help` (`section`,`language`),
KEY `language_constraint` (`language`),
CONSTRAINT `language_constraint` FOREIGN KEY (`language`) REFERENCES `Lm_languages` (`id`),
CONSTRAINT `section_constraint` FOREIGN KEY (`section`) REFERENCES `Lm_help_sections` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
我需要删除“unique_help”键,但我收到外键约束错误。
由于这个错误,我无法删除其中的任何内容,section_constraint、language_constraint、unique_help。
以下是引用此的其他表格:
CREATE TABLE `Lm_languages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`status` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
CREATE TABLE `Lm_help_sections` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1