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;