feat: initial commit and first database layout draft
This commit is contained in:
commit
6b389e2d95
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
1660
Cargo.lock
generated
Normal file
1660
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
7
Cargo.toml
Normal file
7
Cargo.toml
Normal 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
3
src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
41
src/sql/migrations/2024092501_init.sql
Normal file
41
src/sql/migrations/2024092501_init.sql
Normal 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);
|
Loading…
Reference in New Issue
Block a user