2022-11-11 11:55:09 +00:00
|
|
|
BEGIN TRANSACTION;
|
|
|
|
CREATE TABLE IF NOT EXISTS "tags" (
|
2022-11-12 21:59:44 +00:00
|
|
|
"id" INTEGER,
|
2022-11-16 07:56:33 +00:00
|
|
|
"label" TEXT,
|
2022-11-12 21:59:44 +00:00
|
|
|
PRIMARY KEY("id" AUTOINCREMENT)
|
2022-11-11 11:55:09 +00:00
|
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS "files" (
|
2022-11-12 21:59:44 +00:00
|
|
|
"id" INTEGER,
|
2022-11-16 09:53:07 +00:00
|
|
|
"filename" TEXT NOT NULL,
|
|
|
|
"path" TEXT,
|
2022-11-12 21:59:44 +00:00
|
|
|
PRIMARY KEY("id" AUTOINCREMENT)
|
2022-11-11 11:55:09 +00:00
|
|
|
);
|
2022-11-16 09:55:08 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS "metadata" (
|
|
|
|
"fid" INTEGER NOT NULL,
|
|
|
|
"name" TEXT,
|
|
|
|
PRIMARY KEY("fid"),
|
|
|
|
FOREIGN KEY("fid") REFERENCES "files"("id")
|
|
|
|
);
|
2022-11-11 11:55:09 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS "tags_ties" (
|
2022-11-16 08:59:44 +00:00
|
|
|
"fid" INTEGER NOT NULL,
|
|
|
|
"tid" INTEGER NOT NULL,
|
|
|
|
PRIMARY KEY("fid", "tid"),
|
|
|
|
FOREIGN KEY("fid") REFERENCES "files"("id"),
|
|
|
|
FOREIGN KEY("tid") REFERENCES "tags"("id")
|
2022-11-11 11:55:09 +00:00
|
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS "hashes" (
|
|
|
|
"id" INTEGER,
|
2022-11-16 09:55:08 +00:00
|
|
|
"md5" TEXT NOT NULL,
|
|
|
|
"fid" INTEGER NOT NULL,
|
2022-11-11 11:55:09 +00:00
|
|
|
PRIMARY KEY("id" AUTOINCREMENT),
|
2022-11-12 21:59:44 +00:00
|
|
|
FOREIGN KEY("fid") REFERENCES "files"("id")
|
2022-11-11 11:55:09 +00:00
|
|
|
);
|
|
|
|
COMMIT;
|