I am triyng to implement my own FS. I created flat file system table like this:
CREATE TABLE IF NOT EXISTS files (
encoded_url varchar(300) UNIQUE NOT NULL primary key,
file_name varchar(150) NOT NULL,
user_name varchar(65) NOT NULL,
is_public BOOLEAN NOT NULL,
modified DATETIME NOT NULL default CURRENT_TIMESTAMP,
type varchar(20),
size INTEGER(8)
)
So here any user can have any ammount of files. I wonder how to create some kind of collections/one level folders system so that any user could put any ammount of files into his own collections so that he could say have one file in 10 collections? How would look a query for creation of such table look like?
You could create table structure like this:
This way you can have as many collections as user wants and any relation of
fileto acollectionthat you desire. So when file is added to a collection you add the appropriate line intocollection_relationto indicate that.