feat: initial commit and first database layout draft

This commit is contained in:
transcaffeine 2024-09-25 19:14:59 +02:00
commit 6b389e2d95
Signed by: transcaffeine
GPG Key ID: 03624C433676E465
5 changed files with 1712 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

1660
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

7
Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "ice-bingo"
version = "0.1.0"
edition = "2021"
[dependencies]
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio-rustls", "any"] }

3
src/main.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

View File

@ -0,0 +1,41 @@
CREATE TABLE IF NOT EXISTS triebzug (
id INT PRIMARY KEY,
tz_id INT UNIQUE,
name VARCHAR NULL
);
CREATE TABLE IF NOT EXISTS bingo_card (
id INT PRIMARY KEY,
x_pos INT NOT NULL,
y_pos INT NOT NULL,
tz_id INT NOT NULL REFERENCES triebzug(tz_id)
);
CREATE TABLE IF NOT EXISTS bingo_cards (
id INT PRIMARY KEY,
card_id INT NOT NULL REFERENCES bingo_card(id),
start_time INT NOT NULL,
end_time INT NOT NULL
);
CREATE TABLE IF NOT EXISTS user (
id INT PRIMARY KEY,
name VARCHAR NOT NULL
);
CREATE TABLE IF NOT EXISTS webhook (
id INT PRIMARY KEY,
user INT NOT NULL REFERENCES user(id),
secret VARCHAR NOT NULL,
hook VARCHAR NOT NULL
);
CREATE TABLE IF NOT EXISTS checkins (
id INT PRIMARY KEY,
user INT NOT NULL REFERENCES user(id),
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NULL
);
CREATE INDEX tz_id ON triebzug(tz_id);
CREATE INDEX bingo_card_xy ON bingo_card(x_pos, y_pos);