(core): Add app-global setting storage.

New `AppConfig` key-value table for arbitrary app config.
New `KeyValueData` setting data mixin.
New `AppSettings` settings group.
Attached `AppSettings` as `client.settings`.
Migrated sponsor settings to `AppSettings`.
This commit is contained in:
2022-03-19 15:54:34 +02:00
parent bccbf38310
commit ace84c9388
9 changed files with 120 additions and 48 deletions

View File

@@ -1,8 +1,22 @@
-- App Config Data {{{
CREATE TABLE AppConfig(
appid TEXT,
key TEXT,
value TEXT,
PRIMARY KEY(appid, key)
);
-- }}}
-- Sponsor Data {{{
CREATE TABLE sponsor_text(
ID INTEGER PRIMARY KEY DEFAULT 0,
prompt_text TEXT,
command_response TEXT
CREATE TABLE sponsor_guild_whitelist(
guildid INTEGER PRIMARY KEY
);
-- }}}
-- Topgg Data {{{
CREATE TABLE topgg_guild_whitelist(
guildid INTEGER PRIMARY KEY
);
-- }}}

View File

@@ -22,6 +22,13 @@ CREATE TABLE AppData(
last_study_badge_scan TIMESTAMP
);
CREATE TABLE AppConfig(
appid TEXT,
key TEXT,
value TEXT,
PRIMARY KEY(appid, key)
);
CREATE TABLE global_user_blacklist(
userid BIGINT PRIMARY KEY,
ownerid BIGINT NOT NULL,
@@ -37,16 +44,6 @@ CREATE TABLE global_guild_blacklist(
);
-- }}}
-- Sponsor Data {{{
CREATE TABLE sponsor_text(
ID INTEGER PRIMARY KEY DEFAULT 0,
prompt_text TEXT,
command_response TEXT
);
-- }}}
-- User configuration data {{{
CREATE TABLE user_config(
userid BIGINT PRIMARY KEY,
@@ -808,6 +805,16 @@ create TABLE topgg(
boostedTimestamp TIMESTAMPTZ NOT NULL
);
CREATE INDEX topgg_userid_timestamp ON topgg (userid, boostedTimestamp);
CREATE TABLE topgg_guild_whitelist(
guildid INTEGER PRIMARY KEY
);
-- }}}
-- Sponsor Data {{{
CREATE TABLE sponsor_guild_whitelist(
guildid INTEGER PRIMARY KEY
);
-- }}}
-- vim: set fdm=marker: