I want to create a generic mechanism for saving files in my application and database and to do that I have come up with the idea of creating two tables with following schema
in order to save files related to any row in any database table:
FileInfo
=================================================================
ID FileName ContentType FileSize DatabaseTableName RowID
and creating the following table with a OneToOne
relationship to save file data in a seperate table so that querying the FileInfo
table could be performed faster:
FileData
=================================================================
ID FileData
Well I am not an expert in terms of database performance and that's why I would like to know whether such a design that is going to save all files for all tables in one single table will lead to performance issues and is it a bad practice?
And if it will, could you provide me with a better solution?
Thanks in advance