Hey, guys. Yea, yea, I know it's Friday and all...sorry to ask you to think today...
Here's the scenario.
Inventory/purchasing system with 4 types of items:
- Non-inventory items (items known, but not stocked)
- Bulk items (like paper towels, nuts and bolts, etc)
- "Regular" items (like oil filters, etc...non bulk items)
- Serialized items (capital assets that need to be tracked, and have a serial number)
How should one set up a schema for this? The big problem is tracking quantity. Bulk items are tracked by weight, count, etc. Serialized items need to be tracked per item, and the serial number needs to be tracked for it as well.
Now, I can set this up in code, no problem. Something like:
Item --> Item Model (type)
^
InventoriedItem
^ ^ ^
BulkItem RegularItem SerializedItem
The difference between, say "RegularItem" and "SerializedItem", being that RegularItem has a quantity, but no Serial Number, and SerializedItem having no quantity but it does have a Serial Number.
The problem is, how to set this up in the database.
I was leaning towards table inheritance, but was a bit discouraged by this idea from Frans' final post at http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1456 .
The thought is that there should be a row in a table for each serialized item, but only 1 row (in a different table?) for all other items with a quantity column. I thought about putting 1 row for each item in a table, but that just wouldn't work for bulk items which could be measured by weight and it could be a very high number.
I also want to have simple query access to the "catalog". Someone else coming in shouldn't have to search all over the schema to find the various tables that make up the catalog.
Anyone go through this before? Any comments/advice would be helpful.
Jeff...