planetwars.dev/planetwars-server/src/schema.rs

84 lines
1.4 KiB
Rust
Raw Normal View History

2021-12-19 00:16:46 +01:00
table! {
2022-01-03 23:33:00 +01:00
use diesel::sql_types::*;
use crate::db_types::*;
2021-12-19 00:16:46 +01:00
bots (id) {
id -> Int4,
owner_id -> Int4,
name -> Text,
}
}
table! {
2022-01-03 23:33:00 +01:00
use diesel::sql_types::*;
use crate::db_types::*;
2021-12-19 00:16:46 +01:00
code_bundles (id) {
id -> Int4,
bot_id -> Int4,
path -> Text,
created_at -> Timestamp,
}
}
2022-01-02 16:14:03 +01:00
table! {
2022-01-03 23:33:00 +01:00
use diesel::sql_types::*;
use crate::db_types::*;
2022-01-02 16:14:03 +01:00
match_players (match_id, player_id) {
match_id -> Int4,
bot_id -> Int4,
player_id -> Int4,
}
}
table! {
2022-01-03 23:33:00 +01:00
use diesel::sql_types::*;
use crate::db_types::*;
2022-01-02 16:14:03 +01:00
matches (id) {
id -> Int4,
2022-01-03 23:33:00 +01:00
state -> Match_state,
2022-01-02 16:14:03 +01:00
log_path -> Text,
created_at -> Timestamp,
}
}
table! {
2022-01-03 23:33:00 +01:00
use diesel::sql_types::*;
use crate::db_types::*;
sessions (id) {
id -> Int4,
user_id -> Int4,
token -> Varchar,
}
}
table! {
2022-01-03 23:33:00 +01:00
use diesel::sql_types::*;
use crate::db_types::*;
users (id) {
id -> Int4,
username -> Varchar,
password_salt -> Bytea,
password_hash -> Bytea,
}
}
2021-12-19 00:16:46 +01:00
joinable!(bots -> users (owner_id));
joinable!(code_bundles -> bots (bot_id));
2022-01-02 16:14:03 +01:00
joinable!(match_players -> bots (bot_id));
joinable!(match_players -> matches (match_id));
joinable!(sessions -> users (user_id));
2022-01-03 23:33:00 +01:00
allow_tables_to_appear_in_same_query!(
bots,
code_bundles,
match_players,
matches,
sessions,
users,
);