CREATE TABLE IF NOT EXISTS servers (
	id TEXT PRIMARY KEY,
	directory TEXT,
	origin TEXT,
	jvm_arguments TEXT
);
IF user_version < 2;
	ALTER TABLE servers ADD COLUMN origin TEXT;
ENDIF;

CREATE TABLE IF NOT EXISTS builds (
	id INTEGER PRIMARY KEY,
	time INTEGER,
	server_id TEXT REFERENCES servers(id),
	build_string TEXT,
	test_string TEXT,
	compile_time REAL,
	offline INTEGER,
	build_success INTEGER,
	test_success INTEGER,
	cancelled INTEGER,
	test_total INTEGER,
	test_failures INTEGER,
	test_errors INTEGER,
	test_skipped INTEGER,
	jar TEXT
);

CREATE TABLE IF NOT EXISTS deployments (
	id INTEGER PRIMARY KEY,
	server_id TEXT REFERENCES servers(id),
	build_id INTEGER REFERENCES builds(id),
	start_time INTEGER,
	end_time INTEGER
);

PRAGMA user_version = 2;
