- An order line can be created only if corresponding order exists so the foreign key (FK) should be created. Also a piece record can be created only if order line exists.
Define foreign keys
Note: pieces table definition should be moved after po_line due to FK
Introduction of the foreign keys will also prevent records deletion if they are referenced by other entities i.e.
- PO cannot be deleted if there is at least one PO Line
- PO Line cannot be deleted if there is at least one piece record