diff options
Diffstat (limited to 'src/schema.rs')
-rw-r--r-- | src/schema.rs | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/schema.rs b/src/schema.rs index b6074f2..f08221a 100644 --- a/src/schema.rs +++ b/src/schema.rs | |||
@@ -1,10 +1,18 @@ | |||
1 | table! { | 1 | table! { |
2 | members (id) { | 2 | cart_items (cart_id, product_id) { |
3 | cart_id -> Integer, | ||
4 | product_id -> Integer, | ||
5 | } | ||
6 | } | ||
7 | |||
8 | table! { | ||
9 | customer (id) { | ||
3 | id -> Integer, | 10 | id -> Integer, |
4 | username -> Varchar, | 11 | username -> Varchar, |
5 | password -> Varchar, | 12 | password -> Varchar, |
6 | phone_number -> Varchar, | 13 | phone_number -> Varchar, |
7 | email_id -> Varchar, | 14 | email_id -> Varchar, |
15 | address -> Nullable<Text>, | ||
8 | } | 16 | } |
9 | } | 17 | } |
10 | 18 | ||
@@ -18,7 +26,36 @@ table! { | |||
18 | } | 26 | } |
19 | } | 27 | } |
20 | 28 | ||
29 | table! { | ||
30 | rating (id) { | ||
31 | id -> Integer, | ||
32 | comment_text -> Nullable<Text>, | ||
33 | comment_date -> Nullable<Date>, | ||
34 | product_id -> Nullable<Integer>, | ||
35 | customer_id -> Nullable<Integer>, | ||
36 | stars -> Nullable<Integer>, | ||
37 | } | ||
38 | } | ||
39 | |||
40 | table! { | ||
41 | transaction (id) { | ||
42 | id -> Integer, | ||
43 | payment_type -> Varchar, | ||
44 | amount -> Float, | ||
45 | customer_id -> Nullable<Integer>, | ||
46 | } | ||
47 | } | ||
48 | |||
49 | joinable!(cart_items -> customer (cart_id)); | ||
50 | joinable!(cart_items -> product (product_id)); | ||
51 | joinable!(rating -> customer (customer_id)); | ||
52 | joinable!(rating -> product (product_id)); | ||
53 | joinable!(transaction -> customer (customer_id)); | ||
54 | |||
21 | allow_tables_to_appear_in_same_query!( | 55 | allow_tables_to_appear_in_same_query!( |
22 | members, | 56 | cart_items, |
57 | customer, | ||
23 | product, | 58 | product, |
59 | rating, | ||
60 | transaction, | ||
24 | ); | 61 | ); |