mirror of https://gitlab.com/litecord/litecord.git
add voice_regions, voice_servers, and guild.region foreign key
This commit is contained in:
parent
287368ad1c
commit
287678331d
|
|
@ -126,7 +126,7 @@ time period.
|
||||||
|
|
||||||
Sent by the server in reply to a HEARTBEAT message coming from the client.
|
Sent by the server in reply to a HEARTBEAT message coming from the client.
|
||||||
|
|
||||||
The `health` field determines how well is the server's overall health. It is a
|
The `health` field is a measure of the servers's overall health. It is a
|
||||||
float going from 0 to 1, where 0 is the worst health possible, and 1 is the
|
float going from 0 to 1, where 0 is the worst health possible, and 1 is the
|
||||||
best health possible.
|
best health possible.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
-- voice region data
|
||||||
|
-- NOTE: do NOT remove any rows. use deprectated=true and
|
||||||
|
-- DELETE FROM voice_servers instead.
|
||||||
|
CREATE TABLE IF NOT EXISTS voice_regions (
|
||||||
|
-- always lowercase
|
||||||
|
id text PRIMARY KEY,
|
||||||
|
|
||||||
|
-- "Russia", "Brazil", "Antartica", etc
|
||||||
|
name text NOT NULL,
|
||||||
|
|
||||||
|
-- we don't have the concept of vip guilds yet, but better
|
||||||
|
-- future proof.
|
||||||
|
vip boolean DEFAULT FALSE,
|
||||||
|
|
||||||
|
deprecated boolean DEFAULT FALSE,
|
||||||
|
|
||||||
|
-- we don't have the concept of custom regions too. we don't have the
|
||||||
|
-- concept of official guilds either, but i'm keeping this in
|
||||||
|
custom boolean DEFAULT FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- voice server pool. when someone wants to connect to voice, we choose
|
||||||
|
-- a server that is in the same region the guild is too, and choose the one
|
||||||
|
-- with the best health value
|
||||||
|
CREATE TABLE IF NOT EXISTS voice_servers (
|
||||||
|
-- hostname is a reachable url, e.g "brazil2.example.com"
|
||||||
|
hostname text PRIMARY KEY,
|
||||||
|
region_id text REFERENCES voice_regions (id),
|
||||||
|
|
||||||
|
-- health values are more thoroughly defined in the LVSP documentation
|
||||||
|
last_health float default 0.5
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE guilds DROP COLUMN IF EXISTS region;
|
||||||
|
ALTER TABLE guilds ADD COLUMN
|
||||||
|
region text REFERENCES voice_regions (id);
|
||||||
36
schema.sql
36
schema.sql
|
|
@ -318,6 +318,40 @@ CREATE TABLE IF NOT EXISTS user_read_state (
|
||||||
PRIMARY KEY (user_id, channel_id)
|
PRIMARY KEY (user_id, channel_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
-- voice region data
|
||||||
|
-- NOTE: do NOT remove any rows. use deprectated=true and
|
||||||
|
-- DELETE FROM voice_servers instead.
|
||||||
|
CREATE TABLE IF NOT EXISTS voice_regions (
|
||||||
|
-- always lowercase
|
||||||
|
id text PRIMARY KEY,
|
||||||
|
|
||||||
|
-- "Russia", "Brazil", "Antartica", etc
|
||||||
|
name text NOT NULL,
|
||||||
|
|
||||||
|
-- we don't have the concept of vip guilds yet, but better
|
||||||
|
-- future proof.
|
||||||
|
vip boolean DEFAULT FALSE,
|
||||||
|
|
||||||
|
deprecated boolean DEFAULT FALSE,
|
||||||
|
|
||||||
|
-- we don't have the concept of custom regions too. we don't have the
|
||||||
|
-- concept of official guilds either, but i'm keeping this in
|
||||||
|
custom boolean DEFAULT FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- voice server pool. when someone wants to connect to voice, we choose
|
||||||
|
-- a server that is in the same region the guild is too, and choose the one
|
||||||
|
-- with the best health value
|
||||||
|
CREATE TABLE IF NOT EXISTS voice_servers (
|
||||||
|
-- hostname is a reachable url, e.g "brazil2.example.com"
|
||||||
|
hostname text PRIMARY KEY,
|
||||||
|
region_id text REFERENCES voice_regions (id),
|
||||||
|
|
||||||
|
-- health values are more thoroughly defined in the LVSP documentation
|
||||||
|
last_health float default 0.5
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS guilds (
|
CREATE TABLE IF NOT EXISTS guilds (
|
||||||
id bigint PRIMARY KEY NOT NULL,
|
id bigint PRIMARY KEY NOT NULL,
|
||||||
|
|
||||||
|
|
@ -326,7 +360,7 @@ CREATE TABLE IF NOT EXISTS guilds (
|
||||||
splash text DEFAULT NULL,
|
splash text DEFAULT NULL,
|
||||||
owner_id bigint NOT NULL REFERENCES users (id),
|
owner_id bigint NOT NULL REFERENCES users (id),
|
||||||
|
|
||||||
region text NOT NULL,
|
region text NOT NULL REFERENCES voice_regions (id),
|
||||||
|
|
||||||
/* default no afk channel
|
/* default no afk channel
|
||||||
afk channel is voice-only.
|
afk channel is voice-only.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue