I need to track some serialized items in the inventory that can be either dismantled into multiple items or combined together into a single item. I have thought of a few options:
-
Flow tracking – Use two tables for inv_group_out -> inv_group_in with a joining table. Entry into either table can be a single item or multiple items each referencing the original inventory_id. New inventory item(s) get created for the re-entry of the inventory.
-
Movement tracking – Mark all changes in a single modifications table. Can't really think about how to reliably carry this out though.
-
Flow tracking alternative – Use the same table for original purchase/sales using a separate column to indicate that these are just inventory movements
Would love to hear some opinions on which would be preferred.
Best Answer
I'm guessing that you want two things: A full history of each item, and a "current" location of each item. Let's make that two database tables.
When items are "combined", let's give the combination a separate serial number.
When you "combine" a bunch of items:
INSERT
into Combos to get a newcombined_id
.Current
as neededINSERT
multiple rows intoHistory
.