-
Notifications
You must be signed in to change notification settings - Fork 15
/
schema.sql
54 lines (50 loc) · 1.3 KB
/
schema.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
CREATE TABLE _metadatas (
id VARCHAR(20) NOT NULL,
value VARCHAR(128) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE events (
id VARCHAR(256) NOT NULL,
event VARCHAR(64) NOT NULL,
space VARCHAR(256) NOT NULL,
expire INT(11) NOT NULL,
PRIMARY KEY (id, event),
INDEX space (space),
INDEX expire (expire)
);
# Webhook provider
CREATE TABLE subscribers (
id INT NOT NULL AUTO_INCREMENT,
owner VARCHAR(256) NOT NULL,
url TEXT NOT NULL,
method VARCHAR(5) NOT NULL DEFAULT 'POST',
space VARCHAR(256) NOT NULL,
active INT(11) NOT NULL DEFAULT 1,
created INT(11) NOT NULL DEFAULT (UNIX_TIMESTAMP()),
UNIQUE KEY unique_url_space (url(255), space),
PRIMARY KEY (id),
INDEX owner (owner),
INDEX space (space),
INDEX active (active),
INDEX created (created)
);
# Discord provider
CREATE TABLE subscriptions (
guild VARCHAR(64) NOT NULL,
channel VARCHAR(64) NOT NULL,
space VARCHAR(256) NOT NULL,
mention VARCHAR(64) NOT NULL,
events JSON NOT NULL DEFAULT (JSON_ARRAY('proposal/start')),
created VARCHAR(64) NOT NULL,
updated VARCHAR(64) NOT NULL,
PRIMARY KEY (guild, channel, space),
INDEX created (created),
INDEX updated (updated)
);
# XMTP provider
CREATE TABLE xmtp (
address VARCHAR(256) NOT NULL,
status INT(1) NOT NULL,
PRIMARY KEY (address),
INDEX status (status)
);