So I have a problem with the inventory to a web game, I manage to get it to work mostly, but I'm not sure how to handle equipped items. So far I been thinking of adding "table_name" and "table_id" to set where the item is, but I don't know if that such a good idea.

Example:
table_name: "characters" table_id: 3 = The character with id 3 is holding in the item.
table_name: "item_stack" table_id: 5 = Is inside another item, like a bag or backpack
table_name: "Creature" table_id: 8 = A creature/mob/npc is holding in the item.

So far the table look like this
stack_id = primary key
item_id = used with LEFT JOIN and USING to get the item data
amount = the amount it is one stack
table_name
table_id

But is this really a good idea? to use the table name and id to locate where the item should be. I have tried with "recursive_stack_id" and "slot" to put where the item should be in an inventory, but the problem that only work as long as the item is in an inventory, and not if it's held by a creature or character.