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 NOT NULL,
	"path" TEXT,
	PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "tags_ties" (
	"fid"	INTEGER NOT NULL,
	"tid"	INTEGER NOT NULL,
	PRIMARY KEY("fid", "tid"),
	FOREIGN KEY("fid") REFERENCES "files"("id"),
	FOREIGN KEY("tid") REFERENCES "tags"("id")
);
CREATE TABLE IF NOT EXISTS "hashes" (
	"id"	INTEGER,
	"md5"	TEXT,
	"fid"	INTEGER,
	PRIMARY KEY("id" AUTOINCREMENT),
	FOREIGN KEY("fid") REFERENCES "files"("id")
);
COMMIT;