tags/database.sql

27 lines
621 B
MySQL
Raw Normal View History

2022-11-11 11:55:09 +00:00
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "tags" (
"tid" INTEGER,
"label" text,
PRIMARY KEY("tid" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "files" (
"fid" INTEGER,
"filename" text,
PRIMARY KEY("fid" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "tags_ties" (
"id" INTEGER,
"tid" INTEGER,
"fid" INTEGER,
PRIMARY KEY("id" AUTOINCREMENT),
FOREIGN KEY("tid") REFERENCES "tags_ties"("tid"),
FOREIGN KEY("fid") REFERENCES "files"("fid")
);
CREATE TABLE IF NOT EXISTS "hashes" (
"id" INTEGER,
"md5" text,
"fid" int,
PRIMARY KEY("id" AUTOINCREMENT),
FOREIGN KEY("fid") REFERENCES "files"("fid")
);
COMMIT;