Explained junction tables
This commit is contained in:
1 file changed
+8
@@ -18,6 +18,14 @@ When a WorkOrder is done it should in a transaction both set WorkOrder.status =
|
|||||||
|
|
||||||
All prices/rates is using an integer of "Øre" to avoid floating point precision problems, especially on larger amounts.
|
All prices/rates is using an integer of "Øre" to avoid floating point precision problems, especially on larger amounts.
|
||||||
|
|
||||||
|
I used explicit junction tables to handle many-to-many relationships betwithout editing migration files.ween mechanics and skills, mechanics and work orders and spare parts and work orders.
|
||||||
|
|
||||||
|
Some of those tables store extra information about the relationship itself, such as how many minutes a mechanic worked on a work order or the quantity and price of spare parts used.<br />
|
||||||
|
I store the price charged for each spare part in WorkOrderToSparePart rather than SparePart so previous work orders keep their original prices even if the price of the part changes.
|
||||||
|
|
||||||
|
I used composite PKs in the junction tables to prevent duplicates.<br />
|
||||||
|
I also added composite unique constraints where it depends on multiple columns, such as the car model's name within a brand.
|
||||||
|
|
||||||
### PostgreSQL constraints.
|
### PostgreSQL constraints.
|
||||||
|
|
||||||
I wanted to add the CHECK constraint in PostgreSQL.<br />
|
I wanted to add the CHECK constraint in PostgreSQL.<br />
|
||||||
|
|||||||
Reference in new issue
Block a user