forked from LordRalex/absol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
138 lines (124 loc) · 4.49 KB
/
database.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
DELIMITER //
CREATE PROCEDURE `addEditMessage`(
IN `message_id` BIGINT,
IN `new_content` TEXT
)
SQL SECURITY INVOKER
BEGIN
INSERT INTO edits (message_id, old_content)
SELECT id, content
FROM messages
WHERE id = @message_id;
UPDATE messages
SET content = @new_content
WHERE id = @message_id;
END//
DELIMITER ;
CREATE TABLE IF NOT EXISTS `messages` (
`id` bigint(20) unsigned NOT NULL,
`sender` varchar(50) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`guild_id` bigint(20) DEFAULT NULL,
`channel_id` bigint(20) DEFAULT NULL,
`channel` varchar(50) DEFAULT NULL,
`content` mediumtext NOT NULL DEFAULT '',
`deleted` bit(1) NOT NULL DEFAULT b'0',
`reply_id` bigint(20) DEFAULT NULL,
`aud_create_date` timestamp NOT NULL DEFAULT current_timestamp(),
`aud_update_date` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
KEY `sender` (`sender`),
KEY `channel` (`channel_id`),
KEY `guild` (`guild_id`),
KEY `user_id` (`user_id`),
FULLTEXT KEY `content` (`content`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `attachments` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`message_id` bigint(20) NOT NULL,
`url` varchar(4000) DEFAULT NULL,
`name` varchar(4000) DEFAULT NULL,
`contents` longblob DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=34734 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `channels` (
`id` bigint(20) NOT NULL,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `edits` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`message_id` bigint(20) unsigned NOT NULL,
`old_content` blob NOT NULL,
`create_date` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `FK_edits_messages` (`message_id`),
CONSTRAINT `FK_edits_messages` FOREIGN KEY (`message_id`) REFERENCES `messages` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=109893 DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `guilds` (
`id` bigint(20) NOT NULL,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `sites` (
`name` varchar(50) NOT NULL,
`url` varchar(100) NOT NULL,
`rss` varchar(100) NOT NULL,
`servers` varchar(100) NOT NULL,
`elmahUrl` varchar(100) NOT NULL,
`channels` varchar(100) NOT NULL,
`cookie_cobaltsession` varchar(1000) NOT NULL,
`domain` varchar(100) NOT NULL,
`max_errors` tinyint(4) NOT NULL DEFAULT 8,
`period` tinyint(4) NOT NULL DEFAULT 2
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `sites_ignored_errors` (
`site` varchar(50) NOT NULL,
`title` varchar(4000) DEFAULT NULL,
`description` varchar(4000) DEFAULT NULL,
KEY `site` (`site`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `sites_important_errors` (
`site` varchar(50) NOT NULL,
`title` varchar(4000) DEFAULT NULL,
`description` varchar(4000) DEFAULT NULL,
KEY `site` (`site`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `sites_timed_out` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`site` varchar(50) NOT NULL,
`identifier` char(36) DEFAULT NULL,
`log` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `users` (
`id` bigint(20) unsigned NOT NULL,
`name` varchar(100) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `factoids` (
`name` varchar(128) NOT NULL,
`content` varchar(1024) NOT NULL,
PRIMARY KEY (`name`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `hjts` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
`match_criteria` varchar(128) CHARACTER SET utf8mb4 DEFAULT NULL,
`description` varchar(1024) DEFAULT NULL,
`category` varchar(50) DEFAULT NULL,
`severity` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `category` (`category`)
) ENGINE=InnoDB AUTO_INCREMENT=189 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `permissions` (
`discord_id` varchar(50) NOT NULL,
`permission` varchar(64) NOT NULL,
PRIMARY KEY (`discord_id`,`permission`) USING BTREE,
KEY `discord_id` (`discord_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;