bhima
bhima copied to clipboard
Proposal: deprecate document_map and entity_map and use a single uuid_map
Right now, we have two tables that essentially map UUIDs to human readable documents. The general rule is the document_map
contains documents (invoices, vouchers, receipts, transactions, etc) and entity_map
contains entities (employees, patients, etc). Both are simple, identical tables - a binary UUID column and a TEXT column.
I propose we merge these into a single table called uuid_map
that will contain a human readable reference for any uuid in the application. This means we'll be able to add:
- depot_uuid -> depot name
- suppler_uuid -> supplier name
- shipment_uuid -> shipment identifier
And any other UUIDs that don't fit cleanly into the definition above. It will also mean that a developer doesn't have to wonder what table the mapping is contained in, or make a decision about what table to put a new record in.
Another big advantage of this method is that we sometimes have columns that can contain either a document or an entity. For example, stock_movement.entity_uuid
maps to a person, a depot, or a previous movement. Having a single table to match will remove the ambiguity and simply the code.
Note that this could be used to implement Issue 6644.