If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

File Information Storage

Started by jainteq, Jun 20, 2023, 06:35 AM

Previous topic - Next topic

jainteqTopic starter

Greetings to all. I am here to discuss the architectural question that pertains to file storage within a project. Is it acceptable to create a table that stores information about files themselves which exist on disk? While I personally believe that such a table is generally justified, I am not completely certain.

To illustrate my point, let's use the example of a preview image for a news item that is shown in a news list. If we have a table consisting of all files (in this case, just pictures), we can simply store the file id for the preview image. However, if there is no such table, we would need to store the full path from the root of the project instead.

In the event that a file needs to be deleted, if we have used 'Null' everywhere for the preview images for news, then it becomes clearer when the file has been deleted. For images, we can even store the resolution of different versions, making them easier to locate. What are other people's opinions on how information about files should be stored? Please let me know.
  •  


digiconze

I haven't found any justification to store file information in the database based on the problem description. Taking action should be driven by urgent necessity rather than abstract reasoning.

The issue of finding the right resolution version of a file by adding a resolution postfix to its name remains a mystery.

Other projects follow suit depending on their unique circumstances. If there's no need to store additional file information, there's no need to push it into the database.

If a file is part of a database - e.g., it can fit into multiple categories simultaneously - then having a database is essential, and issues like this won't arise.
  •  

cyborgdigital

An additional choice exists: while obtaining a dоcument, it is compressed into three distinct sizes: small, medium, and full. The original file is stored in the database under one ID alongside these three versions.
This setup provides four files that can be utilized for various purposes such as adaptability, preview, or detailed output. Additionally, three of the file types are minimized to decrease traffic volume.
  •  

auditmaster

Certainly, it is reasonable. There are even those who attempt to manually insert the dоcuments into the database :) . From a pragmatic standpoint, one could utilize file aliases, preserve supplementary data, regulate file permissions, and more.
  •  

Fleck

In the context of storing file information within a project, it is acceptable to create a table that stores information about files themselves. This approach can provide several benefits and is commonly used in many systems.

By creating a dedicated table for file storage, you can efficiently organize and manage file-related metadata. It allows you to store important details about each file, such as file ID, name, size, type, storage path, resolution, and any other relevant attributes. Storing this information in a structured manner provides flexibility and ease of access when managing and retrieving files.

In the example you provided, using a file storage table would allow you to store the file ID for the preview image instead of the full path from the root of the project. This can make your data model cleaner and more maintainable.

Additionally, using 'Null' values for preview images when a file is deleted can help ensure data integrity. It provides a clear indication that the file associated with a preview image no longer exists. This approach can simplify error handling and prevent potential issues that may arise from referencing non-existent files.

Storing information about different versions or resolutions of files within the table can also be useful for efficient file retrieval and management.

opinions on how information about files can be stored:

1. Database size: Storing file metadata in a database can increase its size, especially if there is a large number of files. It's important to assess the impact on storage requirements and optimize storage strategies accordingly.

2. Performance: Depending on the size and frequency of file operations in your project, accessing file metadata from a database may introduce some overhead compared to directly accessing the file system. Consider caching mechanisms or efficient querying techniques to mitigate any potential performance impact.

3. Scalability: If your project is expected to handle a high volume of files and concurrent file operations, it's crucial to design a file storage solution that can scale effectively. This could involve distributed storage systems or cloud-based solutions.

4. Security and access control: Storing file metadata in a table enables you to implement granular access controls and security measures for file operations. You can manage permissions and track file access more easily as compared to managing file permissions directly on the file system.

5. Integration with other systems: Storing file metadata in a table can facilitate integration with other systems or services. For instance, you can design APIs or workflows that manipulate file metadata, making it easier to automate file-related operations.
  •  

marcaponte

While storing file metadata in a table might seem like a good idea, it's often a sign of poor design. Instead of creating a separate table, consider using a more robust file storage solution, such as an object storage service or a content delivery network (CDN).
These solutions provide built-in metadata management, scalability, and reliability, making them a more suitable choice for large-scale file storage needs.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...