SQL: standardize id names

This commit is contained in:
Lukáš Kucharczyk 2022-11-12 22:59:44 +01:00
parent b044726c96
commit c71d3af0a2
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
1 changed files with 7 additions and 7 deletions

View File

@ -1,27 +1,27 @@
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "tags" (
"tid" INTEGER,
"id" INTEGER,
"label" text,
PRIMARY KEY("tid" AUTOINCREMENT)
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "files" (
"fid" INTEGER,
"id" INTEGER,
"filename" text,
PRIMARY KEY("fid" AUTOINCREMENT)
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_ties"("tid"),
FOREIGN KEY("fid") REFERENCES "files"("fid")
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"("fid")
FOREIGN KEY("fid") REFERENCES "files"("id")
);
COMMIT;