📜 ⬆️ ⬇️

Database architecture: unification (for example, ERP)


There are concepts of working with the base, based on the ORM, CodeFirst with its own advantages and disadvantages. The database unification proposed here is based primarily on the Database First approach.

The database schema of applications with a complex domain model (which include ERP systems) usually consists of
several hundred tables.
Therefore, at the initial stage of designing the base, it is important to avoid multiple duplications and swelling of the scheme.
decide on several base tables to store the general properties of the basic entities of the application
and all other tables are already designed as auxiliary or additions to the main tables.


Document Design Example:



As a result, the number of tables and the size of the code working with the database will be reduced by an order of magnitude. All that remains for us to do is to extend this approach to documents to others.
')

basic application entities:


constants (types and statuses of documents, attributes of counterparties, types of document links, access modes, types of sending) and editable directories (tags, roles, ..).
We create two const and ref tables and two enum characterizing the record types of these tables. And two more common application tables doc.folder and ref.folder for maintaining the tree structure of documents and editable directories.
One of the drawbacks of this unification is the non-strict limitation of fields at the base level (ie, the field “link to the document tag” will have FK to the edited directory).
It is assumed that the record type of the edited “Tag” directory is controlled at the application level.
Thank you for your attention, comments are welcome.



References:


Source: https://habr.com/ru/post/172177/


All Articles