I need to be able to store files, directories within MySQL, but I don't know how to do it so I can also also have a fairly efficient query to get data from the table for example /swatcat/superscecret.txt
My initial thought was :
DROP TABLE IF EXISTS objects;
CREATE TABLE objects
(
    ID INT NOT NULL AUTO_INCREMENT, 
    filename VARCHAR(200) NOT NULL,
    objectTypeID INT NOT NULL,
    parentID INT,
    PRIMARY KEY (ID),
    FOREIGN KEY (objectTypeID) REFERENCES objectTypes(ID)
);
Object type is either a file or directory:
CREATE TABLE objectTypes
(
    ID INT NOT NULL AUTO_INCREMENT, 
    name VARCHAR(200) NOT NULL UNIQUE,
    PRIMARY KEY (ID)
);
My thought process was parentID would be the directory that the file or directory resides in... The issue though is finding /swatcat/supersecret.txt and what if I decide to rename swatcat to test101 then how do I create a query that could cope with it?
 
    