| Version 9 (modified by , 8 hours ago) ( diff ) |
|---|
Логички и физички дизајн – Креирање база податоци (со SQL DDL)
Релациско мапирање
Ознаки
- Примарните клучеви се означени со bold и underline.
- Надворешните клучеви се означени со FK*, а во заграда е наведена табелата што ја референцираат.
- Задолжителните атрибути се означени со bold.
- Кај сложените примарни клучеви, сите атрибути што го сочинуваат клучот се означени.
Табели
- Customers (customer_id, name, type, tax_id, payment_terms_days)
- Locations (location_id, name, city, country, customer_id FK*(Customers))
- Users (user_id, username, email)
- Roles (role_id, name)
- Has_Role (user_id FK*(Users), role_id FK(Roles)*, assigned_on)
- Drivers (driver_id, first_name, last_name, embg, status)
- Driver_Documents (driver_id FK*(Drivers), doc_no, doc_type, expires_on)
- Vehicles (vehicle_id, plate, vin, vehicle_type, status)
- Vehicle_Documents (vehicle_id FK*(Vehicles), doc_no, doc_type, expires_on)
- Orders (order_id, order_no, order_date, status, customer_id FK*(Customers))
- Loads (order_id FK*(Orders), load_no, cargo_description, weight_kg, agreed_price, status)
- Stops (order_id FK*(Loads), load_no FK(Loads)*, seq_no, stop_type, planned_time, actual_time, location_id FK*(Locations))
- Shipments (order_id FK*(Loads), load_no FK(Loads)*, shipment_no, description, weight_kg, status, stop_order_id FK*(Stops), stop_load_no FK*(Stops), stop_seq_no FK*(Stops))
- Status_History (order_id FK*(Loads), load_no FK(Loads)*, changed_at, status, note, user_id FK*(Users))
- Assignments (assignment_id, planned_start, planned_end, status, order_id FK*(Loads), load_no FK*(Loads), driver_id FK*(Drivers), truck_id FK*(Vehicles), trailer_id FK*(Vehicles))
- Expenses (expense_id, expense_date, amount, note, vehicle_id FK*(Vehicles), order_id FK*(Loads), load_no FK*(Loads), assignment_id FK*(Assignments))
- Fuel_Entries (expense_id FK*(Expenses), liters, price_per_liter, odometer_km)
- Services (expense_id FK*(Expenses), service_type, workshop, odometer_km)
- Tolls (expense_id FK*(Expenses), road_section, country)
- Invoices (invoice_id, invoice_no, issue_date, due_date, customer_id FK*(Customers), user_id FK*(Users))
- Includes (invoice_id FK*(Invoices), order_id FK(Loads)*, load_no FK(Loads)*, amount, description)
- Payments (payment_id, payment_date, amount, method, invoice_id FK*(Invoices))
Attachments (3)
- relational diagram.png (146.9 KB ) - added by 8 hours ago.
- schema_creation.sql (10.5 KB ) - added by 8 hours ago.
- data_load.sql (8.5 KB ) - added by 8 hours ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.
