Skip to main content
1 of 3

What is the best database design when storing documents of different structures for users?

The requirement is: Users should be able to define the strucure of the document they want to store.

For example, a user can decide to store a bank account with the following structure:

  • post_date (date)
  • particulars (text)
  • debit (number)
  • credit (number)
  • value_date (date)
  • reference (text)

then select a file to load it into the database.

Another user or the same user can also load a different document with a different structure.

If we knew all the different structures of documents available, we can create all the tables in the database, but the system must be such a way that the user can load any type of document, and define its own structures.

I am looking for a way to save all this in a single table if possible. Or should I create dynamically a new table table when the user define a new structure of document to load? Is that the best way?