forked from N3MTV/gcphone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitter.sql
50 lines (44 loc) · 2.44 KB
/
twitter.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- --------------------------------------------------------
-- Hôte : 127.0.0.1
-- Version du serveur: 10.3.7-MariaDB - mariadb.org binary distribution
-- SE du serveur: Win64
-- HeidiSQL Version: 10.1.0.5464
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
USE `essentialmode`;
CREATE TABLE IF NOT EXISTS `twitter_accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '0',
`password` varchar(50) COLLATE utf8mb4_bin NOT NULL DEFAULT '0',
`avatar_url` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `twitter_tweets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`authorId` int(11) NOT NULL,
`realUser` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL,
`time` timestamp NOT NULL DEFAULT current_timestamp(),
`likes` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `FK_twitter_tweets_twitter_accounts` (`authorId`),
CONSTRAINT `FK_twitter_tweets_twitter_accounts` FOREIGN KEY (`authorId`) REFERENCES `twitter_accounts` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=170 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
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=137 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;