This repository has been archived by the owner on Jan 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbsetup.sql
114 lines (104 loc) · 2.72 KB
/
dbsetup.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
CREATE TABLE chats
(
chatId bigint NOT NULL
PRIMARY KEY,
groupId int NULL,
username tinytext NULL,
date bigint NULL,
title text NULL,
description text NULL,
member_count int NULL,
type varchar(16) NULL,
is_verified tinyint(1) NULL,
is_scam tinyint(1) NULL,
last_updated bigint NULL,
monitor tinyint(1) NULL
);
CREATE TABLE chats_online_member_count
(
chatId bigint NOT NULL,
date bigint NOT NULL,
member_count int NOT NULL,
PRIMARY KEY (chatId, date)
);
CREATE TABLE chats_updates
(
updateId int AUTO_INCREMENT
PRIMARY KEY,
chatId bigint NULL,
groupId bigint NULL,
`key` tinytext NULL,
old_value varchar(4369) NULL,
new_value varchar(4369) NULL,
date bigint NULL
);
CREATE TABLE content_types
(
typeId int NULL,
type tinytext NULL
);
CREATE TABLE messages
(
messageId bigint NULL,
chatId bigint NULL,
userId bigint NULL,
reply_to bigint NULL,
content_type int NULL,
content varchar(4369) NULL,
date bigint NULL,
deleted_on bigint NULL,
is_channel_post tinyint NULL,
extra text NULL
);
CREATE TABLE messages_edits
(
editId int NULL,
messageId bigint NULL,
old_content varchar(4369) NULL,
new_content varchar(4369) NULL,
date bigint NULL
);
CREATE TABLE messages_files
(
fileUid varchar(256) NOT NULL,
messageId bigint NOT NULL,
cdn_path text NOT NULL,
size bigint NULL,
downloaded bigint NULL,
PRIMARY KEY (messageId, fileUid)
);
CREATE TABLE messages_urls
(
urlId int NULL,
messageId bigint NULL,
url varchar(4369) NULL,
domain varchar(4369) NULL,
path varchar(4369) NULL
);
CREATE TABLE users
(
userId bigint NULL,
username tinytext NULL,
first_name tinytext NULL,
last_name tinytext NULL,
phone_nr tinytext NULL,
is_verified tinyint NULL,
is_support tinyint NULL,
is_scam tinyint NULL,
last_updated bigint NULL,
monitor tinyint NULL
);
CREATE TABLE users_group_memberships
(
userId bigint NULL,
groupId bigint NULL
);
CREATE TABLE users_updates
(
updateId int NULL,
userId bigint NULL,
`key` tinytext NULL,
old_value varchar(4369) NULL,
new_value varchar(4369) NULL,
date bigint NULL
);