forked from milenakos/cat-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
546 lines (483 loc) · 19.3 KB
/
Copy pathschema.sql
File metadata and controls
546 lines (483 loc) · 19.3 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
ALTER SCHEMA public OWNER TO cat_bot;
COMMENT ON SCHEMA public IS '';
SET default_tablespace = '';
SET default_table_access_method = heap;
CREATE TABLE public.channel (
channel_id bigint NOT NULL,
cat bigint DEFAULT 0,
spawn_times_min bigint DEFAULT 60,
spawn_times_max bigint DEFAULT 600,
lastcatches bigint DEFAULT 0,
yet_to_spawn bigint DEFAULT 0,
appear character varying(4000) DEFAULT ''::character varying,
cought character varying(4000) DEFAULT ''::character varying,
webhook character varying(255) DEFAULT ''::character varying,
forcespawned boolean DEFAULT false,
cattype character varying(20) DEFAULT ''::character varying,
cat_rains bigint DEFAULT 0,
rain_should_end bigint DEFAULT 0
);
ALTER TABLE public.channel OWNER TO cat_bot;
CREATE TABLE public.prism (
id integer NOT NULL,
user_id bigint NOT NULL,
guild_id bigint NOT NULL,
"time" bigint NOT NULL,
creator bigint NOT NULL,
name character varying(20) NOT NULL,
catches_boosted integer DEFAULT 0
);
ALTER TABLE public.prism OWNER TO cat_bot;
CREATE SEQUENCE public.prism_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.prism_id_seq OWNER TO cat_bot;
ALTER SEQUENCE public.prism_id_seq OWNED BY public.prism.id;
CREATE TABLE public.profile (
id integer NOT NULL,
user_id bigint NOT NULL,
guild_id bigint NOT NULL,
"time" real DEFAULT 99999999999999,
timeslow real DEFAULT 0,
timeout bigint DEFAULT 0,
catnip_active bigint DEFAULT 0,
dark_market_active boolean DEFAULT false,
battlepass smallint DEFAULT 0,
progress smallint DEFAULT 0,
catnip_level smallint DEFAULT 0,
catnip_total_cats integer DEFAULT 0,
hibernation boolean DEFAULT false,
catnip_price character varying(30) DEFAULT 'Fine'::character varying,
catnip_amount integer DEFAULT 0,
bounty_id_one smallint DEFAULT 0,
bounty_id_two smallint DEFAULT 0,
bounty_id_three smallint DEFAULT 0,
bounty_id_bonus smallint DEFAULT 0,
bounty_type_one character varying(30) DEFAULT ''::character varying,
bounty_type_two character varying(30) DEFAULT ''::character varying,
bounty_type_three character varying(30) DEFAULT ''::character varying,
bounty_type_bonus character varying(30) DEFAULT ''::character varying,
bounty_total_one integer DEFAULT 0,
bounty_total_two integer DEFAULT 0,
bounty_total_three integer DEFAULT 0,
bounty_total_bonus integer DEFAULT 0,
bounty_progress_one integer DEFAULT 0,
bounty_progress_two integer DEFAULT 0,
bounty_progress_three integer DEFAULT 0,
bounty_progress_bonus integer DEFAULT 0,
bounties smallint DEFAULT 0,
perks character varying[] DEFAULT '{}'::character varying[],
perk_selected boolean DEFAULT true,
perk1 character varying(30) DEFAULT ''::character varying,
perk2 character varying(30) DEFAULT ''::character varying,
perk3 character varying(30) DEFAULT ''::character varying,
reroll boolean DEFAULT false,
reroll_level smallint DEFAULT 0,
first_quote_seen boolean DEFAULT false,
funny integer DEFAULT 0,
facts integer DEFAULT 0,
"cat_Fine" integer DEFAULT 0,
"cat_Nice" integer DEFAULT 0,
"cat_Good" integer DEFAULT 0,
"cat_Rare" integer DEFAULT 0,
"cat_Wild" integer DEFAULT 0,
"cat_Gremlin" integer DEFAULT 0,
"cat_Epic" integer DEFAULT 0,
"cat_Sus" integer DEFAULT 0,
"cat_Brave" integer DEFAULT 0,
"cat_Rickroll" integer DEFAULT 0,
"cat_Reverse" integer DEFAULT 0,
"cat_Superior" integer DEFAULT 0,
"cat_Trash" integer DEFAULT 0,
"cat_Legendary" integer DEFAULT 0,
"cat_Mythic" integer DEFAULT 0,
"cat_8bit" integer DEFAULT 0,
"cat_Corrupt" integer DEFAULT 0,
"cat_Professor" integer DEFAULT 0,
"cat_Divine" integer DEFAULT 0,
"cat_Real" integer DEFAULT 0,
"cat_Ultimate" integer DEFAULT 0,
"cat_eGirl" integer DEFAULT 0,
first boolean DEFAULT false,
second boolean DEFAULT false,
third boolean DEFAULT false,
fourth boolean DEFAULT false,
donator boolean DEFAULT false,
anti_donator boolean DEFAULT false,
extrovert boolean DEFAULT false,
fast_catcher boolean DEFAULT false,
slow_catcher boolean DEFAULT false,
collecter boolean DEFAULT false,
trolled boolean DEFAULT false,
achiever boolean DEFAULT false,
leader boolean DEFAULT false,
dark_market boolean DEFAULT false,
bounty_novice boolean DEFAULT false,
bounty_hunter boolean DEFAULT false,
randomizer boolean DEFAULT false,
randomizer2 boolean DEFAULT false,
pineapple boolean DEFAULT false,
daily boolean DEFAULT false,
dm boolean DEFAULT false,
who_ping boolean DEFAULT false,
introvert boolean DEFAULT false,
pleasedonotthecat boolean DEFAULT false,
pleasedothecat boolean DEFAULT false,
worship boolean DEFAULT false,
test_ach boolean DEFAULT false,
"4k" boolean DEFAULT false,
curious boolean DEFAULT false,
car boolean DEFAULT false,
"???" boolean DEFAULT false,
not_quite boolean DEFAULT false,
website_user boolean DEFAULT false,
coffee boolean DEFAULT false,
sussy boolean DEFAULT false,
egril boolean DEFAULT false,
bwomp boolean DEFAULT false,
silly boolean DEFAULT false,
nice boolean DEFAULT false,
click_here boolean DEFAULT false,
patient_reader boolean DEFAULT false,
nerd boolean DEFAULT false,
loud_cat boolean DEFAULT false,
reverse boolean DEFAULT false,
desperate boolean DEFAULT false,
lonely boolean DEFAULT false,
"8k" boolean DEFAULT false,
scammed boolean DEFAULT false,
absolutely_nothing boolean DEFAULT false,
sacrifice boolean DEFAULT false,
not_like_that boolean DEFAULT false,
gambling_one boolean DEFAULT false,
secret boolean DEFAULT false,
good_citizen boolean DEFAULT false,
perfectly_balanced boolean DEFAULT false,
fact_enjoyer boolean DEFAULT false,
morse_cat boolean DEFAULT false,
lucky boolean DEFAULT false,
gambling_two boolean DEFAULT false,
nerd_battle boolean DEFAULT false,
its_not_working boolean DEFAULT false,
rich boolean DEFAULT false,
bounty_lord boolean DEFAULT false,
pie boolean DEFAULT false,
perfection boolean DEFAULT false,
all_the_same boolean DEFAULT false,
paradoxical_gambler boolean DEFAULT false,
darkest_market boolean DEFAULT false,
capitalism boolean DEFAULT false,
profit boolean DEFAULT false,
catn boolean DEFAULT false,
coupon_user boolean DEFAULT false,
dataminer boolean DEFAULT false,
blackhole boolean DEFAULT false,
cat_rain boolean DEFAULT false,
mafia_win boolean DEFAULT false,
thanksforplaying boolean DEFAULT false,
prisms_unlocked boolean DEFAULT false,
boosted boolean DEFAULT false,
news boolean DEFAULT false,
reminder boolean DEFAULT false,
prism boolean DEFAULT false,
balling boolean DEFAULT false,
slots boolean DEFAULT false,
win_slots boolean DEFAULT false,
big_win_slots boolean DEFAULT false,
slot_spins integer DEFAULT 0,
slot_wins integer DEFAULT 0,
slot_big_wins smallint DEFAULT 0,
finale_seen boolean DEFAULT false,
rain_minutes smallint DEFAULT 0,
season smallint DEFAULT 0,
vote_reward smallint DEFAULT 0,
vote_cooldown bigint DEFAULT 1,
catch_quest character varying(30) DEFAULT ''::character varying,
catch_progress smallint DEFAULT 0,
catch_cooldown bigint DEFAULT 1,
catch_reward smallint DEFAULT 0,
misc_quest character varying(30) DEFAULT ''::character varying,
misc_progress smallint DEFAULT 0,
misc_cooldown bigint DEFAULT 1,
misc_reward smallint DEFAULT 0,
weekly_quest character varying(10) DEFAULT ''::character varying,
weekly_progress smallint DEFAULT 0,
weekly_cattypes smallint[] DEFAULT '{}'::smallint[],
reminder_catch bigint DEFAULT 0,
reminder_misc bigint DEFAULT 0,
reminders_enabled boolean DEFAULT false,
multilingual boolean DEFAULT false,
debt boolean DEFAULT false,
debt_seen boolean DEFAULT false,
bp_history character varying DEFAULT ''::character varying,
boosted_catches integer DEFAULT 0,
catnip_activations integer DEFAULT 0,
catnip_bought integer DEFAULT 0,
quests_completed integer DEFAULT 0,
total_catches integer DEFAULT 0,
total_catch_time bigint DEFAULT 0,
perfection_count integer DEFAULT 0,
rain_participations integer DEFAULT 0,
rain_minutes_started integer DEFAULT 0,
reminders_set integer DEFAULT 0,
cats_gifted integer DEFAULT 0,
cat_gifts_recieved integer DEFAULT 0,
trades_completed integer DEFAULT 0,
cats_traded integer DEFAULT 0,
new_user boolean DEFAULT true,
ttt_played integer DEFAULT 0,
ttt_won integer DEFAULT 0,
ttt_draws integer DEFAULT 0,
ttt_win boolean DEFAULT false,
packs_opened integer DEFAULT 0,
pack_upgrades integer DEFAULT 0,
pack_wooden integer DEFAULT 0,
pack_stone integer DEFAULT 0,
pack_bronze integer DEFAULT 0,
pack_silver integer DEFAULT 0,
pack_gold integer DEFAULT 0,
pack_platinum integer DEFAULT 0,
pack_diamond integer DEFAULT 0,
pack_celestial integer DEFAULT 0,
define boolean DEFAULT false,
highlighted_stat character varying(30) DEFAULT 'time_records'::character varying,
highlighted_stat_two character varying(30) DEFAULT 'bp_current'::character varying,
highlighted_stat_three character varying(30) DEFAULT 'profile_value'::character varying,
highlighted_ach character varying(30) DEFAULT ''::character varying,
puzzle_pieces integer DEFAULT 0,
cookies bigint DEFAULT 0,
cookieclicker boolean DEFAULT false,
cookiesclicked boolean DEFAULT false,
event_rain_points integer DEFAULT 0,
best_pig_score integer DEFAULT 0,
pig50 boolean DEFAULT false,
pig100 boolean DEFAULT false,
sphere_easter_egg smallint DEFAULT 0,
sphere_ach boolean DEFAULT false,
casino_balance bigint DEFAULT 1000,
roulette_wins integer DEFAULT 0,
roulette_spins integer DEFAULT 0,
roulette_winner boolean DEFAULT false,
roulette_prodigy boolean DEFAULT false,
failed_gambler boolean DEFAULT false,
certified_yapper boolean DEFAULT false,
ping_reply boolean DEFAULT false,
highest_catnip_level integer DEFAULT 0,
bounties_complete integer DEFAULT 0,
cutscene smallint DEFAULT 0,
snowflakes integer DEFAULT 0,
pack_christmas integer DEFAULT 0,
pack_valentine integer DEFAULT 0,
valentine_user bigint DEFAULT 0,
valentine_progress smallint DEFAULT 0,
ultimates_gifted smallint DEFAULT 0,
last_catch bigint DEFAULT 0,
last_catch_channel bigint DEFAULT 0,
coffees integer DEFAULT 0,
pack_chef integer DEFAULT 0,
baker boolean DEFAULT false,
pack_birthday integer DEFAULT 0,
birthday_rain_progress smallint DEFAULT 0,
catgpt boolean DEFAULT false,
fish_caught integer DEFAULT 0,
rarest_fish character varying(15) DEFAULT ''::character varying,
fisherman boolean DEFAULT false,
pro_fisher boolean DEFAULT false,
bonus_catches integer DEFAULT 0,
math_jumpscare boolean DEFAULT false,
scratchcards smallint DEFAULT 0,
fish_coins bigint DEFAULT 0,
fish_rod_level smallint DEFAULT 0,
fish_rod_durability integer DEFAULT 0,
fish_bait_level smallint DEFAULT 0,
fish_bait_durability integer DEFAULT 0,
fish_clover_level smallint DEFAULT 0,
fish_clover_durability integer DEFAULT 0,
compact_inventory boolean DEFAULT true,
master_baiter boolean DEFAULT false,
cat_auras char(1)[22] DEFAULT array_fill(' '::char(1), ARRAY[22]),
voted_snake boolean DEFAULT false,
snaker boolean DEFAULT false,
blackjacks integer DEFAULT 0,
blackjack_wins integer DEFAULT 0,
twenty_one boolean DEFAULT false,
all_or_nothing boolean DEFAULT false,
imagine_deleting boolean DEFAULT false,
crasher boolean DEFAULT false,
beggar boolean DEFAULT false,
fuwu boolean DEFAULT false,
cancer boolean DEFAULT false,
cellua boolean DEFAULT false,
infinite boolean DEFAULT false,
cataine_addict boolean DEFAULT false,
rugpulled boolean DEFAULT false,
broke boolean DEFAULT false,
buy_stock boolean DEFAULT false,
sell_stock boolean DEFAULT false,
minigamer boolean DEFAULT false,
blackjacker boolean DEFAULT false,
all_done boolean DEFAULT false,
weekly_demon boolean DEFAULT false,
packer boolean DEFAULT false,
super_packer boolean DEFAULT false,
lucky_packy boolean DEFAULT false,
failed boolean DEFAULT false,
tiktoker boolean DEFAULT false,
sharing_enabled boolean DEFAULT false
);
ALTER TABLE public.profile OWNER TO cat_bot;
CREATE SEQUENCE public.profile_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.profile_id_seq OWNER TO cat_bot;
ALTER SEQUENCE public.profile_id_seq OWNED BY public.profile.id;
CREATE TABLE public.reminder (
id integer NOT NULL,
user_id bigint NOT NULL,
"time" bigint NOT NULL,
text character varying(2000) NOT NULL
);
ALTER TABLE public.reminder OWNER TO cat_bot;
CREATE SEQUENCE public.reminder_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.reminder_id_seq OWNER TO cat_bot;
ALTER SEQUENCE public.reminder_id_seq OWNED BY public.reminder.id;
CREATE TABLE public."user" (
user_id bigint NOT NULL,
vote_time_topgg bigint DEFAULT 0,
custom character varying(255) DEFAULT ''::character varying,
emoji character varying(255) DEFAULT ''::character varying,
color character varying(255) DEFAULT ''::character varying,
image character varying(255) DEFAULT ''::character varying,
premium boolean DEFAULT false,
claimed_free_rain boolean DEFAULT false,
rain_minutes smallint DEFAULT 0,
news_state character(2000) DEFAULT ''::character varying,
reminder_vote bigint DEFAULT 0,
custom_num integer DEFAULT 1,
total_votes integer DEFAULT 0,
vote_streak integer DEFAULT 0,
max_vote_streak integer DEFAULT 0,
streak_freezes integer DEFAULT 0,
cats_blessed bigint DEFAULT 0,
blessings_enabled boolean DEFAULT false,
blessings_anonymous boolean DEFAULT false,
rain_minutes_bought integer DEFAULT 0,
username character varying(255) DEFAULT ''::character varying,
dm_channel_id bigint DEFAULT 0,
dms smallint DEFAULT 0,
last_bakegg_send smallint DEFAULT 0,
last_bakegg_get smallint DEFAULT 0,
queued_chef_pack boolean DEFAULT false,
og_badge boolean DEFAULT false,
cataine_badge boolean DEFAULT false,
puzzle_badge boolean DEFAULT false,
plush_badge boolean DEFAULT false,
second_birthday_badge boolean DEFAULT false,
tutorial_state smallint DEFAULT 0,
snake_dms boolean DEFAULT true
);
ALTER TABLE public."user" OWNER TO cat_bot;
CREATE TABLE public.server (
server_id bigint NOT NULL,
only_setupped_channels boolean DEFAULT false,
do_reactions boolean DEFAULT true,
do_responses boolean DEFAULT true,
do_rain boolean DEFAULT true,
do_catnip boolean DEFAULT true,
auto_delete_achievements boolean DEFAULT false,
auto_delete_catches boolean DEFAULT false,
mute_achievements boolean DEFAULT false,
anti_double_catch boolean DEFAULT false,
legacy_catching boolean DEFAULT false,
name text DEFAULT '',
name_style_set boolean DEFAULT false
);
ALTER TABLE public.server OWNER TO cat_bot;
CREATE TABLE public.restore (
id bigint NOT NULL,
guild_id bigint NOT NULL,
user_id bigint DEFAULT 0,
username text DEFAULT ''
);
ALTER TABLE public.restore OWNER TO cat_bot;
CREATE TABLE public.snake (
id smallint DEFAULT 1 UNIQUE,
active boolean DEFAULT false,
dead boolean DEFAULT false,
next_update bigint DEFAULT 0,
pieces smallint[] DEFAULT '{}'::smallint[],
apple smallint DEFAULT 0,
votes_left integer DEFAULT 0,
votes_right integer DEFAULT 0,
votes_up integer DEFAULT 0,
votes_down integer DEFAULT 0
);
ALTER TABLE public.snake OWNER TO cat_bot;
ALTER TABLE ONLY public.prism ALTER COLUMN id SET DEFAULT nextval('public.prism_id_seq'::regclass);
ALTER TABLE ONLY public.profile ALTER COLUMN id SET DEFAULT nextval('public.profile_id_seq'::regclass);
ALTER TABLE ONLY public.reminder ALTER COLUMN id SET DEFAULT nextval('public.reminder_id_seq'::regclass);
ALTER TABLE ONLY public.channel
ADD CONSTRAINT channel_pkey PRIMARY KEY (channel_id);
ALTER TABLE ONLY public.prism
ADD CONSTRAINT prism_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.profile
ADD CONSTRAINT profile_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.reminder
ADD CONSTRAINT reminder_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public."user"
ADD CONSTRAINT user_pkey PRIMARY KEY (user_id);
ALTER TABLE ONLY public.server
ADD CONSTRAINT server_pkey PRIMARY KEY (server_id);
ALTER TABLE ONLY public.restore
ADD CONSTRAINT restore_pkey PRIMARY KEY (id);
CREATE INDEX idx_guild_id ON public.profile USING btree (guild_id);
CREATE INDEX profile_fast_leaderboard ON public.profile (guild_id, "time" ASC, user_id ASC) WHERE "time" < 99999999999999;
CREATE INDEX profile_slow_leaderboard ON public.profile (guild_id, timeslow DESC, user_id ASC) WHERE timeslow > 0;
CREATE INDEX profile_cattlepass_leaderboard ON public.profile (guild_id, season, battlepass DESC, progress DESC, user_id ASC) WHERE battlepass > 0 OR progress > 0;
CREATE INDEX profile_cookies_leaderboard ON public.profile (guild_id, cookies DESC, user_id ASC) WHERE cookies > 0;
CREATE INDEX profile_pig_leaderboard ON public.profile (guild_id, best_pig_score DESC, user_id ASC) WHERE best_pig_score > 0;
CREATE INDEX profile_casino_leaderboard ON public.profile (guild_id, casino_balance DESC, user_id ASC) WHERE casino_balance <> 1000;
CREATE INDEX profile_fish_leaderboard ON public.profile (guild_id, fish_caught DESC, user_id ASC) WHERE fish_caught <> 0;
CREATE UNIQUE INDEX profile_user_id_guild_id ON public.profile USING btree (user_id, guild_id);
CREATE INDEX prism_guild_id ON public.prism USING btree (guild_id);
CREATE INDEX prism_user_id_guild_id ON public.prism USING btree (user_id, guild_id);
CREATE UNIQUE INDEX prism_guild_id_name ON public.prism USING btree (guild_id, name);
CREATE INDEX reminder_time ON public.reminder USING btree ("time");
CREATE INDEX idx_partial_blessings ON public."user" (rain_minutes_bought) WHERE blessings_enabled = true;
CREATE INDEX idx_vote_streak ON public."user" (vote_streak) WHERE vote_streak >= 100;
CREATE INDEX idx_yet_to_spawn ON public.channel (yet_to_spawn);
CREATE MATERIALIZED VIEW public.profile_sums_mv AS SELECT
1 as id,
COALESCE(SUM(total_catches), 0) AS sum_catches
FROM public.profile;
CREATE UNIQUE INDEX profile_sums_mv_id_idx ON public.profile_sums_mv (id);
CREATE MATERIALIZED VIEW public.user_sums_mv AS SELECT
1 as id,
COALESCE(SUM(rain_minutes_bought) FILTER (WHERE blessings_enabled = true), 0) AS sum_blessing_minutes
FROM public."user";
CREATE UNIQUE INDEX user_sums_mv_id_idx ON public.user_sums_mv (id);
REVOKE USAGE ON SCHEMA public FROM PUBLIC;