fix(moderation): one index per query
All checks were successful
Pylint / Pylint (push) Successful in 1m13s
All checks were successful
Pylint / Pylint (push) Successful in 1m13s
This commit is contained in:
parent
71237e02af
commit
604d03ac28
1 changed files with 8 additions and 9 deletions
|
@ -148,11 +148,12 @@ class Moderation(commands.Cog):
|
|||
)
|
||||
"""
|
||||
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))
|
||||
index_query_1 = "CREATE INDEX idx_target_id ON moderation_%s(target_id(25));"
|
||||
cursor.execute(index_query_1, (guild.id))
|
||||
index_query_2 = "CREATE INDEX idx_moderator_id ON moderation_%s(moderator_id(25));"
|
||||
cursor.execute(index_query_2, (guild.id))
|
||||
index_query_3 = "CREATE INDEX idx_moderation_id ON moderation_%s(moderation_id);"
|
||||
cursor.execute(index_query_3, (guild.id))
|
||||
insert_query = f"""
|
||||
INSERT INTO `moderation_{guild.id}`
|
||||
(moderation_id, timestamp, moderation_type, target_id, moderator_id, duration, end_timestamp, reason, resolved, resolved_by, resolve_reason, expired)
|
||||
|
@ -161,11 +162,9 @@ class Moderation(commands.Cog):
|
|||
insert_values = (0, 0, "NULL", 0, 0, "NULL", 0, "NULL", 0, "NULL", "NULL", 0)
|
||||
cursor.execute(insert_query, insert_values)
|
||||
database.commit()
|
||||
database.close()
|
||||
self.logger.info("MySQL Table (moderation_%s) created for %s (%s)", guild.id, guild.name, guild.id)
|
||||
else:
|
||||
database.close()
|
||||
return
|
||||
return "Complete!"
|
||||
|
||||
async def check_conf(self, config: list):
|
||||
"""Checks if any required config options are not set."""
|
||||
|
|
Loading…
Reference in a new issue