CREATE TABLE IF NOT EXISTS tag (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	name TEXT NOT NULL UNIQUE
);

CREATE TABLE IF NOT EXISTS button (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	file TEXT,
	checksum TEXT
);

CREATE TABLE IF NOT EXISTS button_tags (
	fk_tag INTEGER,
	fk_button INTEGER,
	FOREIGN KEY(fk_tag) REFERENCES tag(id),
	FOREIGN KEY(fk_button) REFERENCES button(id),
	PRIMARY KEY(fk_tag, fk_button)
);
