fix(moderation): added indexing to create_guild_table
Some checks failed
Pylint / Pylint (push) Failing after 1m15s

This commit is contained in:
Seaswimmer 2023-10-06 16:12:55 -04:00
parent 60a1f7e500
commit 71237e02af
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -148,6 +148,11 @@ class Moderation(commands.Cog):
) )
""" """
cursor.execute(query) cursor.execute(query)
index_query = f"""
CREATE INDEX idx_target_id ON moderation_%s(target_id(25));
CREATE INDEX idx_moderator_id ON moderation_%s(moderator_id(25));
CREATE INDEX idx_moderation_id ON moderation_%s(moderation_id);"""
cursor.execute(index_query, (guild.id, guild.id, guild.id))
insert_query = f""" insert_query = f"""
INSERT INTO `moderation_{guild.id}` INSERT INTO `moderation_{guild.id}`
(moderation_id, timestamp, moderation_type, target_id, moderator_id, duration, end_timestamp, reason, resolved, resolved_by, resolve_reason, expired) (moderation_id, timestamp, moderation_type, target_id, moderator_id, duration, end_timestamp, reason, resolved, resolved_by, resolve_reason, expired)