-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
108 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
DROP TABLE IF EXISTS join_servers_players CASCADE; | ||
DROP TABLE IF EXISTS servers CASCADE; | ||
DROP TABLE IF EXISTS server_joins CASCADE; | ||
DROP TABLE IF EXISTS players CASCADE; | ||
|
||
CREATE TABLE IF NOT EXISTS servers ( | ||
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, | ||
ip INT NOT NULL, | ||
port SMALLINT NOT NULL, | ||
version_name TEXT, | ||
version_protocol INT, | ||
max_players INT, | ||
online_players INT, | ||
online_anonymous_players INT, | ||
description TEXT, | ||
description_plain TEXT, | ||
enforces_secure_chat BOOLEAN, | ||
previews_chat BOOLEAN, | ||
geyser BOOLEAN, | ||
discovered BIGINT NOT NULL DEFAULT EXTRACT(epoch from now()), | ||
last_seen BIGINT NOT NULL DEFAULT EXTRACT(epoch from now()), | ||
UNIQUE (ip, port), | ||
UNIQUE (id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS server_joins ( | ||
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, | ||
server_id BIGINT NOT NULL, | ||
online_mode BOOLEAN, | ||
whitelist BOOLEAN, | ||
bunger BOOLEAN, | ||
kick_message TEXT, | ||
honeypot BIT(8), | ||
first_joined BIGINT NOT NULL DEFAULT EXTRACT(epoch from now()), | ||
last_joined BIGINT NOT NULL DEFAULT EXTRACT(epoch from now()), | ||
CONSTRAINT fk_server | ||
FOREIGN KEY (server_id) | ||
REFERENCES servers(id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS players ( | ||
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, | ||
uuid UUID NOT NULL, | ||
username TEXT NOT NULL, | ||
java_account BOOLEAN NOT NULL, | ||
bedrock_account BOOLEAN NOT NULL, | ||
UNIQUE (uuid, username) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS join_servers_players ( | ||
server_id BIGINT NOT NULL, | ||
player_id BIGINT NOT NULL, | ||
operator BOOLEAN, | ||
whitelisted BOOLEAN, | ||
discovered BIGINT NOT NULL DEFAULT EXTRACT(epoch from now()), | ||
last_seen BIGINT NOT NULL DEFAULT EXTRACT(epoch from now()), | ||
CONSTRAINT fk_player | ||
FOREIGN KEY (player_id) | ||
REFERENCES players(id), | ||
CONSTRAINT fk_server | ||
FOREIGN KEY (server_id) | ||
REFERENCES servers(id), | ||
CONSTRAINT join_pkey | ||
PRIMARY KEY (server_id, player_id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
DROP TABLE IF EXISTS users CASCADE; | ||
DROP TABLE IF EXISTS discord_users CASCADE; | ||
DROP TABLE IF EXISTS forgejo_users CASCADE; | ||
|
||
CREATE TABLE IF NOT EXISTS users ( | ||
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, | ||
username TEXT NOT NULL, | ||
password TEXT NOT NULL, | ||
permission_level INT NOT NULL DEFAULT 0, | ||
UNIQUE (id), | ||
UNIQUE (username) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS discord_users ( | ||
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, | ||
user_id BIGINT, | ||
discord_id TEXT NOT NULL, | ||
link_code TEXT, | ||
username TEXT NOT NULL, | ||
discriminator TEXT NOT NULL, | ||
global_name TEXT, | ||
UNIQUE (id), | ||
UNIQUE (discord_id), | ||
FOREIGN KEY (user_id) | ||
REFERENCES users (id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS forgejo_users ( | ||
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, | ||
user_id BIGINT, | ||
forgejo_id BIGINT NOT NULL, | ||
link_code TEXT, | ||
username TEXT NOT NULL, | ||
global_name TEXT, | ||
active BOOLEAN NOT NULL, | ||
is_admin BOOLEAN NOT NULL, | ||
prohibit_login BOOLEAN NOT NULL, | ||
restricted BOOLEAN NOT NULL, | ||
UNIQUE (id), | ||
UNIQUE (forgejo_id), | ||
FOREIGN KEY (user_id) | ||
REFERENCES users (id) | ||
); |
This file was deleted.
Oops, something went wrong.