aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/schema.rs
blob: 7f60d64c2b29b64eadf30ed383309b740ab001b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
table! {
    use diesel::sql_types::*;
    use crate::db_types::*;

    bots (id) {
        id -> Int4,
        owner_id -> Int4,
        name -> Text,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::db_types::*;

    code_bundles (id) {
        id -> Int4,
        bot_id -> Int4,
        path -> Text,
        created_at -> Timestamp,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::db_types::*;

    match_players (match_id, player_id) {
        match_id -> Int4,
        bot_id -> Int4,
        player_id -> Int4,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::db_types::*;

    matches (id) {
        id -> Int4,
        state -> Match_state,
        log_path -> Text,
        created_at -> Timestamp,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::db_types::*;

    sessions (id) {
        id -> Int4,
        user_id -> Int4,
        token -> Varchar,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::db_types::*;

    users (id) {
        id -> Int4,
        username -> Varchar,
        password_salt -> Bytea,
        password_hash -> Bytea,
    }
}

joinable!(bots -> users (owner_id));
joinable!(code_bundles -> bots (bot_id));
joinable!(match_players -> bots (bot_id));
joinable!(match_players -> matches (match_id));
joinable!(sessions -> users (user_id));

allow_tables_to_appear_in_same_query!(
    bots,
    code_bundles,
    match_players,
    matches,
    sessions,
    users,
);