1 |
DO $$ BEGIN |
2 |
CREATE TYPE "public"."command_permission_overwrite_action" AS ENUM('Allow', 'Deny'); |
3 |
EXCEPTION |
4 |
WHEN duplicate_object THEN null; |
5 |
END $$; |
6 |
--> statement-breakpoint |
7 |
DO $$ BEGIN |
8 |
CREATE TYPE "public"."infraction_delivery_status" AS ENUM('Success', 'Failed', 'Fallback', 'NotDelivered'); |
9 |
EXCEPTION |
10 |
WHEN duplicate_object THEN null; |
11 |
END $$; |
12 |
--> statement-breakpoint |
13 |
DO $$ BEGIN |
14 |
CREATE TYPE "public"."infraction_type" AS ENUM('Ban', 'Kick', 'Mute', 'Warning', 'MassBan', 'MassKick', 'Unban', 'Unmute', 'BulkDeleteMessage', 'Timeout', 'TimeoutRemove', 'Bean', 'Note', 'Role', 'ModMessage', 'Shot'); |
15 |
EXCEPTION |
16 |
WHEN duplicate_object THEN null; |
17 |
END $$; |
18 |
--> statement-breakpoint |
19 |
DO $$ BEGIN |
20 |
CREATE TYPE "public"."permission_logic_mode" AS ENUM('And', 'Or'); |
21 |
EXCEPTION |
22 |
WHEN duplicate_object THEN null; |
23 |
END $$; |
24 |
--> statement-breakpoint |
25 |
DO $$ BEGIN |
26 |
CREATE TYPE "public"."verification_method" AS ENUM('discord', 'github', 'google', 'email'); |
27 |
EXCEPTION |
28 |
WHEN duplicate_object THEN null; |
29 |
END $$; |
30 |
--> statement-breakpoint |
31 |
CREATE TABLE IF NOT EXISTS "afk_entries" ( |
32 |
"id" serial PRIMARY KEY NOT NULL, |
33 |
"reason" varchar, |
34 |
"user_id" varchar NOT NULL, |
35 |
"guild_id" varchar NOT NULL, |
36 |
"mentions" varchar[] DEFAULT '{}' NOT NULL, |
37 |
"mention_count" integer DEFAULT 0 NOT NULL, |
38 |
"global" boolean DEFAULT false NOT NULL, |
39 |
"created_at" timestamp with time zone DEFAULT now() NOT NULL, |
40 |
"updated_at" timestamp with time zone DEFAULT now() NOT NULL |
41 |
); |
42 |
--> statement-breakpoint |
43 |
CREATE TABLE IF NOT EXISTS "channel_locks" ( |
44 |
"id" serial PRIMARY KEY NOT NULL, |
45 |
"guild_id" varchar NOT NULL, |
46 |
"channel_id" varchar NOT NULL, |
47 |
"permissions" json NOT NULL, |
48 |
"created_at" timestamp with time zone DEFAULT now(), |
49 |
"updated_at" timestamp with time zone DEFAULT now() |
50 |
); |
51 |
--> statement-breakpoint |
52 |
CREATE TABLE IF NOT EXISTS "command_permission_overwrites" ( |
53 |
"id" serial PRIMARY KEY NOT NULL, |
54 |
"guild_id" varchar NOT NULL, |
55 |
"commands" text[] DEFAULT '{}' NOT NULL, |
56 |
"required_discord_permissions" json DEFAULT 'null'::json, |
57 |
"required_system_permissions" json DEFAULT 'null'::json, |
58 |
"required_roles" json DEFAULT 'null'::json, |
59 |
"required_users" json DEFAULT 'null'::json, |
60 |
"required_channels" json DEFAULT 'null'::json, |
61 |
"required_level" integer, |
62 |
"disabled" boolean DEFAULT false, |
63 |
"on_match" "command_permission_overwrite_action" DEFAULT 'Allow' NOT NULL, |
64 |
"created_at" timestamp with time zone DEFAULT now() NOT NULL, |
65 |
"updated_at" timestamp with time zone DEFAULT now() NOT NULL |
66 |
); |
67 |
--> statement-breakpoint |
68 |
CREATE TABLE IF NOT EXISTS "infractions" ( |
69 |
"id" serial PRIMARY KEY NOT NULL, |
70 |
"type" "infraction_type" NOT NULL, |
71 |
"user_id" varchar NOT NULL, |
72 |
"moderator_id" varchar NOT NULL, |
73 |
"guild_id" varchar NOT NULL, |
74 |
"reason" varchar, |
75 |
"expires_at" timestamp with time zone, |
76 |
"metadata" json, |
77 |
"delivery_status" "infraction_delivery_status" DEFAULT 'Success' NOT NULL, |
78 |
"queue_id" integer, |
79 |
"created_at" timestamp with time zone DEFAULT now() NOT NULL, |
80 |
"updated_at" timestamp with time zone DEFAULT now() NOT NULL |
81 |
); |
82 |
--> statement-breakpoint |
83 |
CREATE TABLE IF NOT EXISTS "mute_records" ( |
84 |
"id" serial PRIMARY KEY NOT NULL, |
85 |
"member_id" varchar NOT NULL, |
86 |
"guild_id" varchar NOT NULL, |
87 |
"roles" varchar[] DEFAULT '{}' NOT NULL, |
88 |
"created_at" timestamp with time zone DEFAULT now(), |
89 |
"updated_at" timestamp with time zone DEFAULT now() |
90 |
); |
91 |
--> statement-breakpoint |
92 |
CREATE TABLE IF NOT EXISTS "permission_levels" ( |
93 |
"id" serial PRIMARY KEY NOT NULL, |
94 |
"guild_id" varchar NOT NULL, |
95 |
"level" integer NOT NULL, |
96 |
"disabled" boolean DEFAULT false, |
97 |
"granted_discord_permissions" text[] DEFAULT '{}' NOT NULL, |
98 |
"granted_system_permissions" text[] DEFAULT '{}' NOT NULL, |
99 |
"roles" text[] DEFAULT '{}' NOT NULL, |
100 |
"users" text[] DEFAULT '{}' NOT NULL, |
101 |
"created_at" timestamp with time zone DEFAULT now(), |
102 |
"updated_at" timestamp with time zone DEFAULT now() |
103 |
); |
104 |
--> statement-breakpoint |
105 |
CREATE TABLE IF NOT EXISTS "permission_overwrites" ( |
106 |
"id" serial PRIMARY KEY NOT NULL, |
107 |
"name" text, |
108 |
"guild_id" varchar NOT NULL, |
109 |
"roles" text[] DEFAULT '{}' NOT NULL, |
110 |
"users" text[] DEFAULT '{}' NOT NULL, |
111 |
"granted_discord_permissions" text[] DEFAULT '{}' NOT NULL, |
112 |
"granted_system_permissions" text[] DEFAULT '{}' NOT NULL, |
113 |
"priority" integer DEFAULT 0 NOT NULL, |
114 |
"merge" boolean DEFAULT true NOT NULL, |
115 |
"disabled" boolean DEFAULT false NOT NULL, |
116 |
"created_at" timestamp with time zone DEFAULT now(), |
117 |
"updated_at" timestamp with time zone DEFAULT now() |
118 |
); |
119 |
--> statement-breakpoint |
120 |
CREATE TABLE IF NOT EXISTS "queues" ( |
121 |
"id" serial PRIMARY KEY NOT NULL, |
122 |
"user_id" varchar NOT NULL, |
123 |
"guild_id" varchar NOT NULL, |
124 |
"channel_id" varchar, |
125 |
"message_id" varchar, |
126 |
"name" varchar NOT NULL, |
127 |
"repeat" boolean DEFAULT false, |
128 |
"data" json DEFAULT '{}'::json, |
129 |
"created_at" timestamp with time zone DEFAULT now(), |
130 |
"updated_at" timestamp with time zone DEFAULT now(), |
131 |
"runs_at" timestamp with time zone |
132 |
); |
133 |
--> statement-breakpoint |
134 |
CREATE TABLE IF NOT EXISTS "reaction_roles" ( |
135 |
"id" serial PRIMARY KEY NOT NULL, |
136 |
"emoji" varchar, |
137 |
"is_built_in_emoji" boolean DEFAULT false NOT NULL, |
138 |
"guild_id" varchar NOT NULL, |
139 |
"channel_id" varchar NOT NULL, |
140 |
"message_id" varchar NOT NULL, |
141 |
"roles" varchar[] DEFAULT '{}' NOT NULL, |
142 |
"required_roles" varchar[] DEFAULT '{}' NOT NULL, |
143 |
"blacklisted_users" varchar[] DEFAULT '{}' NOT NULL, |
144 |
"required_permissions" varchar[] DEFAULT '{}' NOT NULL, |
145 |
"level" integer, |
146 |
"single" boolean DEFAULT false NOT NULL, |
147 |
"created_at" timestamp with time zone DEFAULT now() NOT NULL, |
148 |
"updated_at" timestamp with time zone DEFAULT now() NOT NULL |
149 |
); |
150 |
--> statement-breakpoint |
151 |
CREATE TABLE IF NOT EXISTS "snippets" ( |
152 |
"id" serial PRIMARY KEY NOT NULL, |
153 |
"name" varchar, |
154 |
"user_id" varchar NOT NULL, |
155 |
"guild_id" varchar NOT NULL, |
156 |
"aliases" varchar[] DEFAULT '{}' NOT NULL, |
157 |
"roles" varchar[] DEFAULT '{}' NOT NULL, |
158 |
"channels" varchar[] DEFAULT '{}' NOT NULL, |
159 |
"users" varchar[] DEFAULT '{}' NOT NULL, |
160 |
"attachments" varchar[] DEFAULT ARRAY[]::varchar[] NOT NULL, |
161 |
"content" varchar[] DEFAULT ARRAY[]::varchar[] NOT NULL, |
162 |
"randomize" boolean DEFAULT false NOT NULL, |
163 |
"permissions" varchar[] DEFAULT ARRAY[]::varchar[] NOT NULL, |
164 |
"permission_mode" "permission_logic_mode" DEFAULT 'And' NOT NULL, |
165 |
"level" integer, |
166 |
"created_at" timestamp with time zone DEFAULT now() NOT NULL, |
167 |
"updated_at" timestamp with time zone DEFAULT now() NOT NULL |
168 |
); |
169 |
--> statement-breakpoint |
170 |
CREATE TABLE IF NOT EXISTS "users" ( |
171 |
"id" serial PRIMARY KEY NOT NULL, |
172 |
"name" varchar, |
173 |
"username" varchar NOT NULL, |
174 |
"discord_id" varchar NOT NULL, |
175 |
"github_id" varchar, |
176 |
"guilds" varchar[] DEFAULT '{}' NOT NULL, |
177 |
"password" varchar NOT NULL, |
178 |
"token" varchar, |
179 |
"recovery_token" varchar, |
180 |
"recovery_code" varchar, |
181 |
"recovery_attempts" integer DEFAULT 0 NOT NULL, |
182 |
"recovery_token_expires_at" timestamp with time zone, |
183 |
"created_at" timestamp with time zone DEFAULT now() NOT NULL, |
184 |
"token_expires_at" timestamp with time zone, |
185 |
"updated_at" timestamp with time zone DEFAULT now() NOT NULL |
186 |
); |
187 |
--> statement-breakpoint |
188 |
CREATE TABLE IF NOT EXISTS "verification_entries" ( |
189 |
"id" serial PRIMARY KEY NOT NULL, |
190 |
"user_id" varchar NOT NULL, |
191 |
"guild_id" varchar NOT NULL, |
192 |
"code" varchar NOT NULL, |
193 |
"attempts" integer DEFAULT 0 NOT NULL, |
194 |
"metadata" json DEFAULT '{}'::json NOT NULL, |
195 |
"expires_at" timestamp with time zone NOT NULL, |
196 |
"created_at" timestamp with time zone DEFAULT now() NOT NULL, |
197 |
"updated_at" timestamp with time zone DEFAULT now() NOT NULL, |
198 |
CONSTRAINT "verification_entries_code_unique" UNIQUE("code") |
199 |
); |
200 |
--> statement-breakpoint |
201 |
CREATE TABLE IF NOT EXISTS "verification_records" ( |
202 |
"id" serial PRIMARY KEY NOT NULL, |
203 |
"guild_id" varchar NOT NULL, |
204 |
"user_id" varchar NOT NULL, |
205 |
"discord_id" varchar, |
206 |
"github_id" varchar, |
207 |
"google_id" varchar, |
208 |
"email" varchar, |
209 |
"method" "verification_method" NOT NULL, |
210 |
"created_at" timestamp with time zone DEFAULT now() NOT NULL, |
211 |
"updated_at" timestamp with time zone DEFAULT now() NOT NULL |
212 |
); |