aboutsummaryrefslogtreecommitdiff
path: root/backend/src/schema.rs
blob: 1419bc054edc723070038fc8e64e237dc8263677 (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
table! {
    cart_items (cart_id, product_id) {
        cart_id -> Integer,
        product_id -> Integer,
        quantity -> Nullable<Integer>,
    }
}

table! {
    customer (id) {
        id -> Integer,
        username -> Varchar,
        password -> Varchar,
        phone_number -> Varchar,
        email_id -> Varchar,
        address -> Nullable<Text>,
    }
}

table! {
    product (id) {
        id -> Integer,
        name -> Varchar,
        kind -> Nullable<Varchar>,
        price -> Float,
        description -> Nullable<Varchar>,
    }
}

table! {
    rating (id) {
        id -> Integer,
        comment_text -> Nullable<Text>,
        comment_date -> Nullable<Date>,
        product_id -> Nullable<Integer>,
        customer_id -> Nullable<Integer>,
        stars -> Nullable<Integer>,
    }
}

table! {
    transaction (id) {
        id -> Integer,
        payment_type -> Varchar,
        amount -> Float,
        customer_id -> Nullable<Integer>,
        order_date -> Date,
    }
}

joinable!(cart_items -> customer (cart_id));
joinable!(cart_items -> product (product_id));
joinable!(rating -> customer (customer_id));
joinable!(rating -> product (product_id));
joinable!(transaction -> customer (customer_id));

allow_tables_to_appear_in_same_query!(
    cart_items,
    customer,
    product,
    rating,
    transaction,
);