storage: add guild.features in get_guild

- remove features and guild_features tables
This commit is contained in:
Luna 2019-03-09 03:27:12 -03:00
parent fa73e90170
commit a04b3acfaa
3 changed files with 10 additions and 22 deletions

View File

@ -155,7 +155,7 @@ class Storage:
explicit_content_filter, mfa_level,
embed_enabled, embed_channel_id::text,
widget_enabled, widget_channel_id::text,
system_channel_id::text
system_channel_id::text, features
FROM guilds
WHERE guilds.id = $1
""", guild_id)
@ -918,9 +918,6 @@ class Storage:
if guild:
dinv['guild'] = dict(guild)
# TODO: query actual guild features
dinv['guild']['features'] = []
else:
dinv['guild'] = {}

View File

@ -0,0 +1,4 @@
DROP TABLE guild_features;
DROP TABLE features;
ALTER TABLE guilds ADD COLUMN features text[];

View File

@ -362,12 +362,13 @@ CREATE TABLE IF NOT EXISTS guilds (
region text NOT NULL REFERENCES voice_regions (id),
/* default no afk channel
afk channel is voice-only.
*/
features text[],
-- default no afk channel
-- afk channel is voice-only.
afk_channel_id bigint REFERENCES channels (id) DEFAULT NULL,
/* default 5 minutes */
-- default 5 minutes
afk_timeout int DEFAULT 300,
-- from 0 to 4
@ -482,20 +483,6 @@ CREATE TABLE IF NOT EXISTS group_dm_members (
);
CREATE TABLE IF NOT EXISTS features (
id serial PRIMARY KEY,
feature text NOT NULL
);
CREATE TABLE IF NOT EXISTS guild_features (
guild_id bigint REFERENCES guilds (id) ON DELETE CASCADE,
feature integer REFERENCES features (id),
PRIMARY KEY (guild_id, feature)
);
CREATE TABLE IF NOT EXISTS guild_integrations (
guild_id bigint REFERENCES guilds (id) ON DELETE CASCADE,
user_id bigint REFERENCES users (id) ON DELETE CASCADE,