tags/database.sql

27 lines
609 B
MySQL
Raw Normal View History

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-11 11:55:09 +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-11 11:55:09 +00:00
"filename" 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 "tags_ties" (
"id" INTEGER,
"tid" INTEGER,
"fid" INTEGER,
PRIMARY KEY("id" AUTOINCREMENT),
2022-11-12 21:59:44 +00:00
FOREIGN KEY("tid") REFERENCES "tags"("id"),
FOREIGN KEY("fid") REFERENCES "files"("id")
2022-11-11 11:55:09 +00:00
);
CREATE TABLE IF NOT EXISTS "hashes" (
"id" INTEGER,
"md5" text,
"fid" int,
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;