为什么能写入重复数据呢?在存在唯一索引前提下。请大神帮忙解惑,谢谢
唯一索引:UNIQUE KEY `uwu` (`UserId`,`WeixinOpenid`,`UnionID`),
1:表结构信息如下:
CREATE TABLE `t_weixin` (
`WeixinId` bigint(20) NOT NULL AUTO_INCREMENT,
`MallId` bigint(20) DEFAULT NULL,
`UserId` bigint(20) DEFAULT NULL,
`RefereeUserId` bigint(20) DEFAULT NULL,
`WeixinOpenid` varchar(100) NOT NULL,
`Attentiontime` datetime DEFAULT NULL,
`UnionID` varchar(100) NOT NULL,
`HeadPic` varchar(255) DEFAULT NULL,
`Nickname` varchar(100) DEFAULT NULL,
`Type` int(1) DEFAULT NULL,
`AppId` varchar(100) DEFAULT NULL,
PRIMARY KEY (`WeixinId`),
UNIQUE KEY `uwu` (`UserId`,`WeixinOpenid`,`UnionID`),
KEY `FK_Reference_53` (`MallId`),
KEY `FK_Reference_54` (`UserId`),
KEY `FK_Reference_55` (`RefereeUserId`),
CONSTRAINT `FK_Reference_53` FOREIGN KEY (`MallId`) REFERENCES `t_mall` (`MallId`),
CONSTRAINT `FK_Reference_54` FOREIGN KEY (`UserId`) REFERENCES `t_user` (`UserId`),
CONSTRAINT `FK_Reference_55` FOREIGN KEY (`RefereeUserId`) REFERENCES `t_user` (`UserId`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
2: