DROP TABLE IF EXISTS project;
CREATE TABLE project (
	title VARCHAR(64) NOT NULL,
	body TEXT DEFAULT NULL,
	difficulty INT NOT NULL DEFAULT 1 REFERENCES difficulty(diff),
	repo_link VARCHAR(128) DEFAULT NULL,
	trigger_date DATE DEFAULT NULL,
	started DATE NOT NULL DEFAULT CURRENT_DATE,
	span INT NOT NULL DEFAULT 7					-- time to last for in days
);

DROP TABLE IF EXISTS difficulty;
CREATE TABLE difficulty (
	diff VARCHAR(16)
);

DROP TABLE IF EXISTS tag;
CREATE TABLE tag (
	t VARCHAR(16)
);

DROP TABLE IF EXISTS project_tag;
CREATE TABLE project_tag (
	project INT REFERENCES project(rowid),
	tag INT REFERENCES tag(rowid)
);

DROP TABLE IF EXISTS assignment;
CREATE TABLE assignment (
	who VARCHAR(32) NOT NULL,
	project INT NOT NULL REFERENCES project(rowid)
);
