Search code examples
phpmysqldatabasedatamodelinventory-management

License template mysql table


I have to develop a software inventory (with php and mysql) and i´m planning the data model/design. The problem is that every software supplier has a different license type, with different field so it´s not as simple as creating a "licenses" table.

My best solution till now is create a "licenses" table and a "templates" table where each has about 10 columns named from 1 to 10. The license table holds the data and the templates table holds the column o field name for that data.

Is there a better way of implementing this?


Solution

  • If serializtion is not an option, then another option would be a key value design:

    Table: LicenceAttributes
    
    LicenceID | FieldName     | FieldValue
    1         | numberofusers | 5
    1         | cost          | 999
    2         | somethingelse | blah
    

    Like serialization, this is only a sutable design if the fields are genuinly different accross all licences.