-
Notifications
You must be signed in to change notification settings - Fork 927
/
schema.go
66 lines (46 loc) · 1.59 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package tickets
var DBSchemas = []string{`
CREATE TABLE IF NOT EXISTS ticket_configs (
guild_id BIGINT PRIMARY KEY,
enabled BOOLEAN NOT NULL,
ticket_open_msg TEXT NOT NULL,
tickets_channel_category BIGINT NOT NULL,
status_channel BIGINT NOT NULL,
tickets_transcripts_channel BIGINT NOT NULL,
download_attachments BOOLEAN NOT NULL,
tickets_use_txt_transcripts BOOLEAN NOT NULL,
mod_roles BIGINT[],
admin_roles BIGINT[]
);
`, `
ALTER TABLE ticket_configs ADD COLUMN IF NOT EXISTS tickets_transcripts_channel_admin_only BIGINT NOT NULL DEFAULT 0;
`, `
CREATE TABLE IF NOT EXISTS tickets (
guild_id BIGINT NOT NULL,
local_id BIGINT NOT NULL,
channel_id BIGINT NOT NULL,
title TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
closed_at TIMESTAMP WITH TIME ZONE,
logs_id BIGINT NOT NULL,
author_id BIGINT NOT NULL,
author_username_discrim TEXT NOT NULL,
PRIMARY KEY(guild_id, local_id)
);
`, `
CREATE INDEX IF NOT EXISTS tickets_guild_id_channel_id_idx ON tickets(guild_id, channel_id);
`, `
CREATE TABLE IF NOT EXISTS ticket_participants (
ticket_guild_id BIGINT NOT NULL,
ticket_local_id BIGINT NOT NULL,
user_id BIGINT NOT NULL,
username TEXT NOT NULL,
discrim TEXT NOT NULL,
is_staff BOOLEAN NOT NULL,
-- This is bugged in sqlboiler, sooooo don't use it for now i guess
-- FOREIGN KEY (ticket_guild_id, ticket_local_id) REFERENCES tickets(guild_id, local_id) ON DELETE CASCADE,
PRIMARY KEY(ticket_guild_id, ticket_local_id, user_id)
);
`, `
CREATE INDEX IF NOT EXISTS ticket_participants_ticket_local_id_idx ON ticket_participants(ticket_guild_id, ticket_local_id);
`}