I am working on a problem. The problem is i have multiple links to a file, and a link to multiple links to a single file (files that are protected and have a userid+key thus require a different link). So for my file i have the fileid, path and misc data (i called it status for now).
Is this table structure good? I am using sqlite and may move into mysql. if i delete a file search for fileID in both tables and delete the entries. if a user clicks a link it will search for the link name in table link then look up its associated file. This is the best way to do this? theres nothing else i can/should do like have some sort of non unique key for better lookup in the link table?
CREATE TABLE file
(
fileId INTEGER PRIMARY KEY,
status int NOT NULL
name varchar(255),
);
CREATE TABLE link
(
fileId INTEGER,
link varchar(255) unique
);