| 1 | |
| 2 | |
| 3 | == Relational Mapping - Partial Transformation |
| 4 | === Notations |
| 5 | * Primary keys are marked with **__bold and underlined letters__** \\ |
| 6 | * Foreign keys are marked with * |
| 7 | === Relational Schema |
| 8 | 1. User(**__id__**, email, street, city, phone_number, password) |
| 9 | 2. Employee(**__user_id__***, net_salary, gross_salary) |
| 10 | 3. Customer(**__user_id__***) |
| 11 | 4. Manager(**__user_id__***) |
| 12 | 5. FrontStaff(**__employee_id__***, tip_percent, staff_role_id*) |
| 13 | 6. BackStaff(**__employee_id__***, staff_role_id*) |
| 14 | 7. StaffRole(**__staff_role_id__**, name) |
| 15 | 8. Shift(**__shift_id__**, date, start, end, manager_id*) |
| 16 | 9. Assignment(**__id__**, clock_in_time, clock_out_time, manager_id*, employee_id*, shift_id*) |
| 17 | |
| 18 | 10. Reservation(**__id__**, stay_length, datetime, creation_timestamp, number_of_people, user_id*) |
| 19 | 11. Reservation_managed_FrontStaff(**__reservation_id__***, **__employee_id__***, **__table_number__***) |
| 20 | |
| 21 | 12. Category(**__id__**, name, is_available) |
| 22 | 13. Product(**__id__**, name, price, tax_class, description, manage_inventory, category_id*) |
| 23 | 14. Inventory(**__product_id__***, quantity, restock_level) |
| 24 | 15. OrderItem(**__id__**, quantity, price, is_processed, timestamp, product_id*, order_id*) |
| 25 | |
| 26 | 16. Order(**__id__**, timestamp, status) |
| 27 | 17. TabOrder(**__order_id__***, table_number*, frontstaff_id*) |
| 28 | 18. OnlineOrder(**__order_id__***, **__customer_id__***, delivery_adress) |
| 29 | 19. Table(**__table_number__**, seat_capacity) |
| 30 | 20. Payment(**__id__**, tip_amount, timestamp, payment_type, amount, order_id*) |
| 31 | |
| 32 | == DDL Script for Dropping and Creating Tables |
| 33 | [attachment:ddl (1).sql] |
| 34 | == DML Script for Populating Tables with Data |
| 35 | [attachment:dml (1).sql] |
| 36 | == Tables |
| 37 | [[Image(schema1.png)]] |