BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "cities" (
	"id"	string,
	"owner"	string,
	"totalSpace"	int,
	"usedSpace"	int,
	"gold"	int,
	"ore"	int,
	"logs"	int,
	"bushels"	int,
	"population"	int,
	"soliders"	int,
	"attackers"	int,
	"defenders"	int,
	"sp_attackers"	int,
	"sp_defenders"	int,
	"soldiers"	int after population,
	"farms"	int,
	"barracks"	int,
	"special_attacker_trainer"	int,
	"special_defender_trainer"	int,
	PRIMARY KEY("id")
);
CREATE TABLE IF NOT EXISTS "locations" (
	"sector_id"		int,
	"city_id"		text unique,
	"location_x"	int,
	"location_y"	int
);
CREATE TABLE IF NOT EXISTS "ticks" (
	"current_tick"	int,
	"last_tick_at"	int
);
CREATE TABLE IF NOT EXISTS "sessions" (
	"id"	text,
	"account_id"	TEXT,
	PRIMARY KEY("id")
);
CREATE TABLE IF NOT EXISTS "build_queues" (
	"id"	text,
	"building_type"	text,
	"owner"	text,
	"created"	int,
	"due"	int,
	"amount"	int,
	PRIMARY KEY("id")
);
CREATE TABLE IF NOT EXISTS "unit_training_queue" (
	"id"	string,
	"unit_type"	text,
	"owner"	text,
	"created"	int,
	"due"	int,
	"amount"	int,
	PRIMARY KEY("id")
);
CREATE TABLE IF NOT EXISTS "buildings" (
	"slug"	text,
	"display"	text UNIQUE,
	"gold"	int,
	"ore"	int,
	"logs"	int,
	"land"	int,
	"time"	int,
	PRIMARY KEY("slug")
);
CREATE TABLE IF NOT EXISTS "units" (
	"slug"	,
	"display"	,
	"gold"	,
	"bushels"	,
	"population"	,
	"soldiers"	,
	"attackers"	,
	"defenders"	,
	"time"	,
	"attack"	int,
	"defence"	int
);
CREATE TABLE IF NOT EXISTS "army_queue" (
	"id"	text,
	"owner"	text,
	"your_city"	text,
	"created"	int,
	"due"	int,
	"soldiers"	int,
	"attackers"	int,
	"defenders"	int,
	"sp_attackers"	int,
	"sp_defenders"	int,
	"attacked_city"	text,
	PRIMARY KEY("id")
);
CREATE TABLE IF NOT EXISTS "mail" (
	"id"	text,
	"to_account"	text,
	"from_account"	text,
	"type"	text,
	"sent_at"	int,
	"read_at"	int,
	"subject"	text,
	"message"	text,
	PRIMARY KEY("id")
);
INSERT INTO "locations" VALUES (1, '-', -1, -1);
INSERT INTO "buildings" VALUES ('farms','Farms',20,0,40,1,14);
INSERT INTO "buildings" VALUES ('barracks','Barracks',40,10,60,1,16);
INSERT INTO "buildings" VALUES ('special_attacker_trainer','Sp. Attacker Trainer',80,40,100,2,20);
INSERT INTO "buildings" VALUES ('special_defender_trainer','Sp. Defender Trainer',100,60,80,2,20);
INSERT INTO "units" VALUES ('soldiers','Soldiers',2,1,1,0,0,0,2,2.1,1);
INSERT INTO "units" VALUES ('attackers','Attackers',5,2,0,1,0,0,3,4,1);
INSERT INTO "units" VALUES ('defenders','Defenders',4,2,0,1,0,0,5,1,4);
INSERT INTO "units" VALUES ('sp_attackers','Sp. Attacker',9,4,0,0,1,0,7,7,3);
INSERT INTO "units" VALUES ('sp_defenders','Sp. Defender',11,5,0,0,0,1,10,2,9);