18 | | '''EMBG''' – VARCHAR(13) (Primary Key) |
19 | | '''!FirstName''' – VARCHAR(50) (Mandatory attribute) |
20 | | '''!LastName''' – VARCHAR(50) (Mandatory attribute) |
| 29 | ==== 4. ServiceItems ==== |
| 30 | '''Id''' – SERIAL (Primary Key) // |
| 31 | '''!Description''' – TEXT (Mandatory attribute) // |
| 32 | '''!MeasurementUnit''' – VARCHAR(20) (Mandatory attribute) // |
| 33 | '''!PricePerUnit''' – DECIMAL(10,2) (Mandatory attribute) // |
| 34 | '''Tax''' – DECIMAL(5,2) (Mandatory attribute) // |
24 | | '''Id''' – SERIAL (Primary Key) |
25 | | '''!ClientId''' – INT (Mandatory attribute, Foreign Key to Clients.Id with ON DELETE CASCADE) |
26 | | '''!Model''' – VARCHAR(50) (Mandatory attribute) |
27 | | '''Year''' – INT |
28 | | '''!ChassisNumber''' – VARCHAR(50) (Unique) |
29 | | '''Registration''' – VARCHAR(20) |
30 | | '''Kilometers''' – INT |
| 43 | ==== 6. ServiceAssignments ==== |
| 44 | '''!ServiceId''' – INT (Foreign Key to Services.Id with ON DELETE CASCADE) // |
| 45 | '''MechanicEMBG''' – VARCHAR(13) (Foreign Key to Mechanics.EMBG with ON DELETE CASCADE) // |
| 46 | '''!ServiceItemId''' – INT (Foreign Key to ServiceItems.Id with ON DELETE CASCADE) // |
| 47 | '''!UnitsUsed''' – DECIMAL(10,2) (Mandatory attribute) // |
| 48 | '''Composite Primary Key''': (ServiceId, MechanicEMBG, ServiceItemId) // |
34 | | '''Id''' – SERIAL (Primary Key) |
35 | | '''!Description''' – TEXT (Mandatory attribute) |
36 | | '''!MeasurementUnit''' – VARCHAR(20) (Mandatory attribute) |
37 | | '''!PricePerUnit''' – DECIMAL(10,2) (Mandatory attribute) |
38 | | '''Tax''' – DECIMAL(5,2) (Mandatory attribute) |
| 56 | ==== 8. FiscalBills ==== |
| 57 | '''Id''' – SERIAL (Primary Key) // |
| 58 | '''!ServiceInvoiceId''' – INT (Unique, Mandatory attribute, Foreign Key to ServiceInvoices.Id with ON DELETE CASCADE) // |
| 59 | '''!IssueDateTime''' – TIMESTAMP (Mandatory attribute, defaults to NOW()) // |
| 60 | '''Description''' – TEXT // |
| 61 | '''DDV''' – DECIMAL(5,2) (Mandatory attribute) // |
| 62 | '''EDB''' – VARCHAR(15) (Mandatory attribute) // |
40 | | ==== 5. Services ==== |
41 | | |
42 | | '''Id''' – SERIAL (Primary Key) |
43 | | '''!MotorcycleId''' – INT (Mandatory attribute, Foreign Key to Motorcycles.Id with ON DELETE CASCADE) |
44 | | '''!DateOfService''' – DATE (Mandatory attribute) |
45 | | '''!LaborCost''' – DECIMAL(10,2) (Mandatory attribute) |
46 | | '''!TotalPrice''' – DECIMAL(10,2) (Mandatory attribute; calculated manually by the application) |
47 | | |
48 | | ==== 6. ServiceAssignments (Junction Table) ==== |
49 | | |
50 | | '''!ServiceId''' – INT (Foreign Key to Services.Id with ON DELETE CASCADE) |
51 | | '''MechanicEMBG''' – VARCHAR(13) (Foreign Key to Mechanics.EMBG with ON DELETE CASCADE) |
52 | | '''!ServiceItemId''' – INT (Foreign Key to ServiceItems.Id with ON DELETE CASCADE) |
53 | | '''!UnitsUsed''' – DECIMAL(10,2) (Mandatory attribute) |
54 | | '''Composite Primary Key''': (ServiceId, MechanicEMBG, ServiceItemId) |
55 | | |
56 | | ==== 7. ServiceInvoices ==== |
57 | | |
58 | | '''Id''' – SERIAL (Primary Key) |
59 | | '''!ServiceId''' – INT (Unique, Mandatory attribute, Foreign Key to Services.Id with ON DELETE CASCADE) |
60 | | '''!IssueDate''' – TIMESTAMP (Mandatory attribute, defaults to NOW()) |
61 | | '''!ImagePath''' – TEXT (Mandatory attribute) |
62 | | |
63 | | ==== 8. FiscalBills ==== |
64 | | |
65 | | '''Id''' – SERIAL (Primary Key) |
66 | | '''!ServiceInvoiceId''' – INT (Unique, Mandatory attribute, Foreign Key to ServiceInvoices.Id with ON DELETE CASCADE) |
67 | | '''!IssueDateTime''' – TIMESTAMP (Mandatory attribute, defaults to NOW()) |
68 | | '''Description''' – TEXT |
69 | | '''DDV''' – DECIMAL(5,2) (Mandatory attribute) |
70 | | '''EDB''' – VARCHAR(15) (Mandatory attribute) |