| 6 | |
| 7 | == Податочни побарувања == |
| 8 | |
| 9 | '''Ентититети''' |
| 10 | // |
| 11 | |
| 12 | 1. PRODUCT_CATEGORY |
| 13 | a. id serial, |
| 14 | b. category_name varchar |
| 15 | c. constraint pk_cid primary key(id) |
| 16 | 2. PRODUCT |
| 17 | a. id serial |
| 18 | b. sku varchar |
| 19 | c. name varchar |
| 20 | d. description varchar |
| 21 | e. unit_price decimal |
| 22 | f. image_url varchar |
| 23 | g. units_in_stock integer |
| 24 | h. date_created timestamp |
| 25 | i. last_updated timestamp |
| 26 | j. category_id integer |
| 27 | k. constraint pk_id primary key(id) |
| 28 | l. constraint fk_cid foreign key(category_id) references product_category(id) |
| 29 | 3. CUSTOMER |
| 30 | a. id serial |
| 31 | b. first_name varchar |
| 32 | c. last_name varchar |
| 33 | d. email varchar unique |
| 34 | e. constraint pk_customer primary key(id) |
| 35 | 4. ADDRESS |
| 36 | a. id serial |
| 37 | b. city varchar |
| 38 | c. country varchar |
| 39 | d. street varchar |
| 40 | e. zip_code varchar |
| 41 | f. constraint pk_address primary_key(id) |
| 42 | 5. ORDERS |
| 43 | a. id bigserial |
| 44 | b. order_tracking_number varchar |
| 45 | c. total_price decimal |
| 46 | d. total_quantity int |
| 47 | e. customer_id int |
| 48 | f. last_updated timestamp |
| 49 | g. billing_address_id int unique |
| 50 | h. shipping_address unique |
| 51 | i. constraint pk_orders primary key(id) |
| 52 | j. constraint fk_billing_add foreign key(billing_address_id) references address(id) |
| 53 | k. constraint fk_shipping_add foreign key(shipping_address_id) references address(id) |
| 54 | 6. ORDERED_ITEM |
| 55 | a. id serial |
| 56 | b. quantity int |
| 57 | c. order_id bigserial |
| 58 | d. product_id int |
| 59 | e. constraint pk_order_item primary key(id) |
| 60 | f. constraint fk_order_id foreign key(order_id) references orders(id) |
| 61 | g. constraint fk_product_id foreign key(product_id) references product(id) |
| 62 | // |
| 63 | |
| 64 | Следните два ентитети се ентитети за Држава и Град кои служат за популирање на полиња во апликацијата на front-end. |
| 65 | 7. COUNTRY |
| 66 | a. id serial |
| 67 | b. code varchar |
| 68 | c. name varchar |
| 69 | d. constraint pk_country primary_key(id) |
| 70 | 8. CITY |
| 71 | a. id serial |
| 72 | b. name varchar |
| 73 | c. country_id int |
| 74 | d. constraint pk_city primary key(id), |
| 75 | e. constraint fk_country foreign key(country_id) references country(id) |
| 76 | |