Skip to content

Commit 158710f

Browse files
committed
Fix sql (order table for key)
1 parent 86b4303 commit 158710f

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

twitter.sql

+11-20
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@
1111
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
1212
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
1313

14-
15-
-- Listage de la structure de la base pour essentialmode
16-
CREATE DATABASE IF NOT EXISTS `essentialmode` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
1714
USE `essentialmode`;
1815

19-
-- Listage de la structure de la table essentialmode. twitter_accounts
2016
CREATE TABLE IF NOT EXISTS `twitter_accounts` (
2117
`id` int(11) NOT NULL AUTO_INCREMENT,
2218
`username` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '0',
@@ -26,21 +22,6 @@ CREATE TABLE IF NOT EXISTS `twitter_accounts` (
2622
UNIQUE KEY `username` (`username`)
2723
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
2824

29-
-- Les données exportées n'étaient pas sélectionnées.
30-
-- Listage de la structure de la table essentialmode. twitter_likes
31-
CREATE TABLE IF NOT EXISTS `twitter_likes` (
32-
`id` int(11) NOT NULL AUTO_INCREMENT,
33-
`authorId` int(11) DEFAULT NULL,
34-
`tweetId` int(11) DEFAULT NULL,
35-
PRIMARY KEY (`id`),
36-
KEY `FK_twitter_likes_twitter_accounts` (`authorId`),
37-
KEY `FK_twitter_likes_twitter_tweets` (`tweetId`),
38-
CONSTRAINT `FK_twitter_likes_twitter_accounts` FOREIGN KEY (`authorId`) REFERENCES `twitter_accounts` (`id`),
39-
CONSTRAINT `FK_twitter_likes_twitter_tweets` FOREIGN KEY (`tweetId`) REFERENCES `twitter_tweets` (`id`) ON DELETE CASCADE
40-
) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
41-
42-
-- Les données exportées n'étaient pas sélectionnées.
43-
-- Listage de la structure de la table essentialmode. twitter_tweets
4425
CREATE TABLE IF NOT EXISTS `twitter_tweets` (
4526
`id` int(11) NOT NULL AUTO_INCREMENT,
4627
`authorId` int(11) NOT NULL,
@@ -53,7 +34,17 @@ CREATE TABLE IF NOT EXISTS `twitter_tweets` (
5334
CONSTRAINT `FK_twitter_tweets_twitter_accounts` FOREIGN KEY (`authorId`) REFERENCES `twitter_accounts` (`id`)
5435
) ENGINE=InnoDB AUTO_INCREMENT=170 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5536

56-
-- Les données exportées n'étaient pas sélectionnées.
37+
CREATE TABLE IF NOT EXISTS `twitter_likes` (
38+
`id` int(11) NOT NULL AUTO_INCREMENT,
39+
`authorId` int(11) DEFAULT NULL,
40+
`tweetId` int(11) DEFAULT NULL,
41+
PRIMARY KEY (`id`),
42+
KEY `FK_twitter_likes_twitter_accounts` (`authorId`),
43+
KEY `FK_twitter_likes_twitter_tweets` (`tweetId`),
44+
CONSTRAINT `FK_twitter_likes_twitter_accounts` FOREIGN KEY (`authorId`) REFERENCES `twitter_accounts` (`id`),
45+
CONSTRAINT `FK_twitter_likes_twitter_tweets` FOREIGN KEY (`tweetId`) REFERENCES `twitter_tweets` (`id`) ON DELETE CASCADE
46+
) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
47+
5748
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
5849
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
5950
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

0 commit comments

Comments
 (0)