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
table! {
    use diesel::sql_types::*;
    use crate::syslog::Op_type;

    address (id) {
        id -> Int4,
        client_id -> Int4,
        #[sql_name = "type"]
        type_ -> Int2,
        location -> Varchar,
        number -> Varchar,
        complement -> Nullable<Varchar>,
        district -> Varchar,
        state -> Bpchar,
        city -> Varchar,
        country -> Bpchar,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::syslog::Op_type;

    client (id) {
        id -> Int4,
        #[sql_name = "type"]
        type_ -> Int2,
        name -> Varchar,
        document -> Varchar,
        active -> Bool,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::syslog::Op_type;

    product (id) {
        id -> Int4,
        description -> Varchar,
        unit -> Bpchar,
        price -> Numeric,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::syslog::Op_type;

    stock (product_id) {
        product_id -> Int4,
        amount -> Numeric,
        cost -> Numeric,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::syslog::Op_type;

    stock_mov (id) {
        id -> Int4,
        product_id -> Int4,
        document -> Varchar,
        amount -> Numeric,
        cost -> Numeric,
        shipping_cost -> Numeric,
        date -> Timestamptz,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::syslog::Op_type;

    syslog (id) {
        id -> Int4,
        service -> Varchar,
        requestor -> Varchar,
        entity -> Varchar,
        operation -> Op_type,
        datetime -> Timestamptz,
        description -> Nullable<Varchar>,
    }
}

table! {
    use diesel::sql_types::*;
    use crate::syslog::Op_type;

    user (id) {
        id -> Int4,
        login -> Varchar,
        name -> Varchar,
        email -> Nullable<Varchar>,
        pwhash -> Bytea,
    }
}

joinable!(address -> client (client_id));

allow_tables_to_appear_in_same_query!(
    address,
    client,
    product,
    stock,
    stock_mov,
    syslog,
    user,
);