I want to make a webapplication in witch there will be some users with different projects (like c project, c++ project so on). My question is that how should I build up my 3 tables: users,projects,files? One user can have many projects (there will be shared projects too), the projects can have folders(packages) and files, but on the file system I don't want to make that folder hierarchy only pointers to the specific file from database.
I.e. I am user1 and I have project1 with 3 folders in it: headers,resource,source and in each folder or root there are several files. The thing is I want to get all the project-related data from user1 and put it in a tree-view, but on the server all the files are in the same folder with randomly generated names.
The VFS serves as an abstraction layer that gives applications access to different types of file systems and local and network storage devices. For that reason, a VFS may also be known as a virtual file system switch.
Other Unix virtual file systems include the File System Switch in System V Release 3, the Generic File System in Ultrix, and the VFS in Linux. In OS/2 and Microsoft Windows, the virtual file system mechanism is called the Installable File System.
A database management system has a low level of data inconsistency. You can store data as discrete data files and entities using the File System. Data, as well as defined restrictions and interrelationships, are stored in a database management system. Support for complex transactions is not available.
You could use a structure like the one below.
Alternatively you could store your files within the database in some sort of BLOB
(MEDIUMBLOB
).
users
id
name
...
projects
id
name
...
user_projects
user_id
project_id
folders
id
name
project_id
parent_folder_id
...
files
id
filename
parent_folder_id
name_in_filesystem
...
You have a list of users
, and a list of projects
. The user_project
table allows you to assign several users to a project, and to assign several projects to a user.
Every folder
belongs to one project, and can have a parent_folder_id
to allow hierarchies. Every file has a parent_folder_id
, which is the reference to the folder that contains it. The name_in_filesystem
is the random name that you use to store the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With