-
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
1 parent
0c21bb7
commit 8ccac42
Showing
16 changed files
with
217 additions
and
224 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 |
---|---|---|
@@ -1 +1 @@ | ||
DATABASE_URL=sqlite://.sqlx-check.db?mode=rwc | ||
DATABASE_URL=postgres://postgres@[::]:5432/postgres |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
*.sql linguist-detectable | ||
api_documentation.md linguist-detectable |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/.idea | ||
/target | ||
|
||
/.sqlx-check.db | ||
/Cargo.lock |
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
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,90 @@ | ||
CREATE TABLE players ( | ||
uuid UUID | ||
PRIMARY KEY, | ||
username VARCHAR(16) | ||
NOT NULL | ||
UNIQUE, | ||
|
||
registered TIMESTAMP | ||
NOT NULL | ||
DEFAULT 'now', | ||
last_online TIMESTAMP | ||
NOT NULL | ||
DEFAULT 'now', | ||
|
||
show_registered BOOLEAN | ||
NOT NULL | ||
DEFAULT true, | ||
show_status BOOLEAN | ||
NOT NULL | ||
DEFAULT true, | ||
retain_usernames BOOLEAN | ||
NOT NULL | ||
DEFAULT true | ||
); | ||
|
||
CREATE TABLE previous_usernames ( | ||
player UUID | ||
NOT NULL, | ||
username VARCHAR(16) | ||
NOT NULL, | ||
public BOOLEAN | ||
NOT NULL | ||
DEFAULT TRUE, | ||
|
||
FOREIGN KEY (player) REFERENCES players(uuid) ON DELETE CASCADE | ||
); | ||
|
||
CREATE TABLE tokens ( | ||
token BYTEA | ||
PRIMARY KEY, | ||
player UUID, | ||
|
||
created TIMESTAMP | ||
NOT NULL | ||
CHECK (used >= created) | ||
DEFAULT 'now', | ||
used TIMESTAMP | ||
NOT NULL | ||
CHECK (used >= created) | ||
DEFAULT 'now', | ||
|
||
revoked BOOLEAN | ||
NOT NULL | ||
DEFAULT false, | ||
expired BOOLEAN | ||
NOT NULL | ||
GENERATED ALWAYS AS (used - created > '1 day') STORED, | ||
valid BOOLEAN | ||
NOT NULL | ||
GENERATED ALWAYS AS (player IS NOT NULL AND NOT revoked AND NOT used - created > '1 day') STORED, | ||
|
||
FOREIGN KEY (player) REFERENCES players(uuid) ON DELETE SET NULL | ||
); | ||
|
||
CREATE TABLE channels ( | ||
id BIGINT | ||
PRIMARY KEY, | ||
name VARCHAR(32) | ||
NOT NULL | ||
UNIQUE, | ||
owner UUID | ||
NOT NULL, | ||
|
||
created TIMESTAMP | ||
NOT NULL | ||
DEFAULT 'now', | ||
last_updated TIMESTAMP | ||
NOT NULL | ||
DEFAULT 'now', | ||
last_message TIMESTAMP | ||
NOT NULL | ||
DEFAULT 'now', | ||
|
||
persistence SMALLINT | ||
NOT NULL, | ||
persistence_count INT, | ||
persistence_duration_seconds INT, | ||
|
||
FOREIGN KEY (owner) REFERENCES players(uuid) ON DELETE CASCADE | ||
); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.