0

We're building a new piece of software for our company, where we want to manage our inventory. The goal for the tool is to be customizable by the customer.

My part is mostly on the DB side. We have chosen MariaDB as our DB engine, and while we are working with the rather static functionality of a relational DB, we want to realize a rather dynamic solution.

Our chief programmer has explained to me the basics of the concept I shall implement into our DB:

We want a table which basically just consists of other tables. Lets call it "maintable". Maintable shall then reference its "attributes", which are the other tables. For example, maintable references "Workstations". "Workstations" then contains attributes like CPU, RAM, Drives, PSU etc..

And now comes the part which I didn't completely understand. The actual VALUES to these attributes in "Workstations" shall not be inserted into "Workstations". Instead, they are packed into another (junction?) table.

The reason for this approach is that the customer shall be able to customize the DB to his needs. When the customer wants to add another attribute, he shall be able to do so. For example, if a new PSU now requires another attribute for an additional serial number, then the customer shall be able to simply create this new attribute in the front-end input form and then persist it to the DB.

If someone could point to good tutorials explaining this type of DB concept, then I would be glad as well! :=)

Narktor
  • 977
  • 14
  • 34
  • 1
    Software managing 'a “dynamic” relational database' is called a DBMS. Your application offers some functionality of a DBMS. The easiest & straightforward way to write such software is to delegate it to a DBMS. – philipxy Jan 27 '20 at 09:52
  • 1
    The classic non-delegating design pattern that is frequently an anti-pattern when used is [EAV](https://stackoverflow.com/a/23950836/3404097). Another is OTLT. These involve re-implementing a DBMS instead of using the one you have. But people are afraid of or unaware of delegating via DDL+DML. – philipxy Jan 27 '20 at 09:56
  • 1
    Asking for off-site resources is off-topic. Nevertheless there are a lot of duplicate questions re accomplishing what you want on SO. So search here too. Re asking about such designs rather than asking about references: Before considering posting please always google any error message or many clear, concise & precise phrasings of your question/problem/goal, with & without your particular strings/names & site:stackoverflow.com & tags, & read many answers. If you post a question, use one phrasing as title. See [ask] & the voting arrow mouseover texts. – philipxy Jan 27 '20 at 10:04
  • You are embarking on the not-so-pleasant schema design of "Entity-Attribute-Value". Search for that tag in stackoverflow.com – Rick James Feb 02 '20 at 01:43
  • [A related Stack Overflow question.](https://stackoverflow.com/questions/66385/dynamic-database-schema) – FloverOwe Oct 07 '21 at 21:00

0 Answers0