Should file addresses be kept in a database when there is a default directory structure?

0

I have a table where I keep references to files, the columns are:

  • id (auto-incremental)
  • version (char size 3)
  • title
  • description
  • cover (layer address)
  • file (file address)

Considering that at most 1 file will be uploaded per month, as well as the directory structure shown below:

 arquivos
 |__ xxx (representa a versão)
     |__ arquivo.pdf
     |__ capa.jpeg

It makes sense to have the columns capa and arquivo in the database? I ask this as it can be observed, there is a very well defined directory structure, files simply by mounting the path from the version column, resulting in:

  • xxx /file.pdf
  • xxx /capa.jpeg

I thought of removing these two columns from the database and include in the preference table the root directory address, this would make my life easier if in the future I have to move this directory to another location.

Any recommendations or considerations on this issue? Is there any design-pattern guiding this question?

Note: I think it is not relevant, but I would like to clarify that I am using Laravel 5.6 for this application.

    
asked by anonymous 20.03.2018 / 00:29

0 answers