SQL Error (1005): Can't create table `kibra-v3`.`twitter_likes`(errno: 150 "Foreign key constraint is incorrect formed")
Hata bu şekilde. Hata verdiğini düşündüğüm kod ise aşağıda:
CREATE TABLE IF NOT EXISTS `twitter_likes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`authorId` int(11) DEFAULT NULL,
`tweetId` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_twitter_likes_twitter_accounts` (`authorId`),
KEY `FK_twitter_likes_twitter_tweets` (`tweetId`),
CONSTRAINT `FK_twitter_likes_twitter_accounts` FOREIGN KEY (`authorId`) REFERENCES `twitter_accounts` (`id`),
CONSTRAINT `FK_twitter_likes_twitter_tweets` FOREIGN KEY (`tweetId`) REFERENCES `twitter_tweets` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=605 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Yardımcı olabilirsen sevinirim.
Hata bu şekilde. Hata verdiğini düşündüğüm kod ise aşağıda:
CREATE TABLE IF NOT EXISTS `twitter_likes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`authorId` int(11) DEFAULT NULL,
`tweetId` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_twitter_likes_twitter_accounts` (`authorId`),
KEY `FK_twitter_likes_twitter_tweets` (`tweetId`),
CONSTRAINT `FK_twitter_likes_twitter_accounts` FOREIGN KEY (`authorId`) REFERENCES `twitter_accounts` (`id`),
CONSTRAINT `FK_twitter_likes_twitter_tweets` FOREIGN KEY (`tweetId`) REFERENCES `twitter_tweets` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=605 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Yardımcı olabilirsen sevinirim.