I am creating a database table, one of the columns can take the shape of all possible multimedia (text,video,audio,image). Without going into overkill of creating several different columns or multiple tables I decided that I should rather have a file pointer that points to where the data resides on the server and have an extra column that indicates the type of data present for the given row.
I want to know if this is a good design strategy or if there are better existing alternatives?
Thanks much,
Parijat
This is a fine strategy. In addition to the type of file, I would recommend adding a column that stores the length in bytes of the file, to save you retrieving it from the filesystem when you need to supply it in a
Content-lengthheader, for example.If you expected all files to be of a relatively consistent size (none too large like video files), it might be preferable to store the data as binary blobs in the database, but given that you expect diverse media types and possibly very diverse file sizes, I think it makes more sense to keep the files in the filesystem and point to them from the database.