-
Notifications
You must be signed in to change notification settings - Fork 921
/
schema.go
48 lines (33 loc) · 1.34 KB
/
schema.go
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
package commands
const DBSchema = `
CREATE TABLE IF NOT EXISTS commands_channels_overrides (
id BIGSERIAL PRIMARY KEY,
guild_id BIGINT NOT NULL,
channels BIGINT[],
channel_categories BIGINT[],
global bool NOT NULL,
commands_enabled BOOL NOT NULL,
autodelete_response BOOL NOT NULL,
autodelete_trigger BOOL NOT NULL,
autodelete_response_delay INT NOT NULL,
autodelete_trigger_delay INT NOT NULL,
require_roles BIGINT[] NOT NULL,
ignore_roles BIGINT[] NOT NULL
);
CREATE INDEX IF NOT EXISTS commands_channels_overrides_guild_idx ON commands_channels_overrides(guild_id);
CREATE UNIQUE INDEX IF NOT EXISTS commands_channels_overrides_global_uniquex ON commands_channels_overrides (guild_id) WHERE global;
CREATE TABLE IF NOT EXISTS commands_command_overrides (
id BIGSERIAL PRIMARY KEY,
guild_id BIGINT NOT NULL,
commands_channels_overrides_id BIGINT references commands_channels_overrides(id) ON DELETE CASCADE NOT NULL,
commands TEXT[] NOT NULL,
commands_enabled BOOL NOT NULL,
autodelete_response BOOL NOT NULL,
autodelete_trigger BOOL NOT NULL,
autodelete_response_delay INT NOT NULL,
autodelete_trigger_delay INT NOT NULL,
require_roles BIGINT[] NOT NULL,
ignore_roles BIGINT[] NOT NULL
);
CREATE INDEX IF NOT EXISTS commands_command_groups_channels_override_idx ON commands_command_overrides(commands_channels_overrides_id);
`