-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
95 lines (95 loc) · 2.38 KB
/
schema.sql
File metadata and controls
95 lines (95 loc) · 2.38 KB
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
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "attachments" (
"id" INTEGER,
"related_message_id" INTEGER,
"file_name" TEXT,
"timestamp" INTEGER,
"extension" TEXT,
"year" INTEGER,
);
CREATE TABLE IF NOT EXISTS "likes" (
"attachment_id" INTEGER,
"discord_id" INTEGER,
"timestamp" INTEGER,
);
CREATE TABLE IF NOT EXISTS "message_likes" (
"message_id" INTEGER,
"discord_id" INTEGER,
"timestamp" INTEGER
);
CREATE TABLE IF NOT EXISTS "messages" (
"message_id" INTEGER,
"type" TEXT,
"timestamp" INTEGER,
"content" TEXT,
"author_id" INTEGER,
"author_name" TEXT,
"author_nickname" TEXT,
"author_discriminator" TEXT,
"author_avatar_url" TEXT,
"attachments" BLOB,
"embeds" BLOB,
"stickers" BLOB,
"reactions" BLOB,
"total_reactions" INTEGER,
"mentions" BLOB,
"inline_emojis" BLOB,
"channel_id" INTEGER,
"channel_name" TEXT,
"content_length" INTEGER,
"year" INTEGER,
PRIMARY KEY("message_id")
);
CREATE TABLE IF NOT EXISTS "users" (
"user_id" INTEGER,
"user_name" TEXT,
"user_nickname" TEXT,
"user_avatar_url" TEXT,
"mentions_received" INTEGER,
"mentions_given" INTEGER,
"reactions_received" INTEGER,
"reactions_given" INTEGER,
"messages_sent" INTEGER,
"attachments_sent" INTEGER,
"attachments_size" INTEGER,
"most_frequent_time" INTEGER,
"most_mentioned_given_name" TEXT,
"most_mentioned_received_name" TEXT,
"most_mentioned_given_id" INTEGER,
"most_mentioned_received_id" INTEGER,
"most_mentioned_given_count" INTEGER,
"most_mentioned_received_count" INTEGER,
"emoji_data" BLOB,
"year" INTEGER,
);
CREATE TABLE IF NOT EXISTS "static" ("key" TEXT, "value" BLOB, "year" INTEGER)
CREATE UNIQUE INDEX IF NOT EXISTS "idx_key_year" ON "static" (
"key",
"year"
);
CREATE TABLE IF NOT EXISTS "word_usage" ("word" TEXT, "data" BLOB, "year" INTEGER)
CREATE UNIQUE INDEX IF NOT EXISTS "idx_word_year" ON "word_usage" (
"word",
"year"
);
CREATE UNIQUE INDEX IF NOT EXISTS "idx_attachment_id_discord_id" ON "likes" (
"attachment_id",
"discord_id"
);
CREATE UNIQUE INDEX IF NOT EXISTS "idx_attachments_id" ON "attachments" (
"id"
);
CREATE UNIQUE INDEX IF NOT EXISTS "idx_message_id_discord_id" ON "message_likes" (
"message_id",
"discord_id"
);
CREATE INDEX IF NOT EXISTS "idx_messages_content" ON "messages" (
"content"
);
CREATE INDEX IF NOT EXISTS "idx_messages_total_reactions" ON "messages" (
"total_reactions"
);
CREATE INDEX IF NOT EXISTS "idx_messages_year" ON "messages" (
"year"
)
COMMIT;