tags/database.sql

27 lines
609 B
SQL

BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "tags" (
"id" INTEGER,
"label" text,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "files" (
"id" INTEGER,
"filename" text,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "tags_ties" (
"id" INTEGER,
"tid" INTEGER,
"fid" INTEGER,
PRIMARY KEY("id" AUTOINCREMENT),
FOREIGN KEY("tid") REFERENCES "tags"("id"),
FOREIGN KEY("fid") REFERENCES "files"("id")
);
CREATE TABLE IF NOT EXISTS "hashes" (
"id" INTEGER,
"md5" text,
"fid" int,
PRIMARY KEY("id" AUTOINCREMENT),
FOREIGN KEY("fid") REFERENCES "files"("id")
);
COMMIT;