1
0
Fork 0
mirror of https://github.com/uhIgnacio/EmoteManager.git synced 2024-08-15 02:23:13 +00:00
EmoteManager/schema.sql
2021-04-06 04:22:17 +00:00

21 lines
713 B
SQL

SET TIME ZONE 'UTC';
-- inserted for every time a command is invoked
CREATE TABLE invokes (
-- nullable because it may be invoked in DMs
guild_id BIGINT,
-- hashed for privacy
user_id_md5 BYTEA NOT NULL,
-- the qualified name of the command invoked (https://discordpy.readthedocs.io/en/stable/ext/commands/api.html?highlight=qualified_name#discord.ext.commands.Command.qualified_name)
command TEXT NOT NULL,
invoked_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX invokes_invoked_at_idx ON invokes (invoked_at);
CREATE TABLE shard_info (
shard_id INT2 PRIMARY KEY,
-- sum(guild.member_count for guild in shard)
member_count INT4 NOT NULL,
guild_count INT2 NOT NULL
);