aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/schema.rs
blob: 2c5ab2a6c5fb36ba214a3603c311cfa214b4e52f (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// This file is autogenerated by diesel
#![allow(unused_imports)]

// @generated automatically by Diesel CLI.

pub mod sql_types {
    #[derive(diesel::sql_types::SqlType)]
    #[diesel(postgres_type(name = "match_state"))]
    pub struct MatchState;
}

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

    bot_versions (id) {
        id -> Int4,
        bot_id -> Nullable<Int4>,
        code_bundle_path -> Nullable<Text>,
        created_at -> Timestamp,
        container_digest -> Nullable<Text>,
    }
}

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

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

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

    maps (id) {
        id -> Int4,
        name -> Text,
        file_path -> Text,
    }
}

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

    match_players (match_id, player_id) {
        match_id -> Int4,
        player_id -> Int4,
        bot_version_id -> Nullable<Int4>,
        had_errors -> Nullable<Bool>,
    }
}

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

    matches (id) {
        id -> Int4,
        state -> MatchState,
        log_path -> Text,
        created_at -> Timestamp,
        winner -> Nullable<Int4>,
        is_public -> Bool,
        map_id -> Nullable<Int4>,
    }
}

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

    ratings (bot_id) {
        bot_id -> Int4,
        rating -> Float8,
    }
}

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

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

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

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

diesel::joinable!(bots -> users (owner_id));
diesel::joinable!(match_players -> bot_versions (bot_version_id));
diesel::joinable!(match_players -> matches (match_id));
diesel::joinable!(matches -> maps (map_id));
diesel::joinable!(ratings -> bots (bot_id));
diesel::joinable!(sessions -> users (user_id));

diesel::allow_tables_to_appear_in_same_query!(
    bot_versions,
    bots,
    maps,
    match_players,
    matches,
    ratings,
    sessions,
    users,
);