PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "battle" (
"id" INT,
"name" TEXT,
"date" TEXT,
"bulgarian_commander" TEXT,
"latin_commander" TEXT,
"result" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "ship" (
"lost_in_battle" INT,
"id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("lost_in_battle") REFERENCES "battle"("id")
);





INSERT INTO "battle" VALUES ("1", "Battle of Adrianople", "1205-04-14", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("2", "Siege of Thessalonica", "1207-06-01", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("3", "Battle of Philippopolis", "1208-09-20", "Kaloyan", "Baldwin I", "Draw");
INSERT INTO "battle" VALUES ("4", "Battle of Rusion", "1206-03-15", "Kaloyan", "Baldwin I", "Latin victory");
INSERT INTO "battle" VALUES ("5", "Battle of Adrianople", "1205-04-14", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("6", "Battle of Messinopolis", "1207-11-10", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("7", "Battle of Tryavna", "1190-08-26", "Kaloyan", "NULL", "Bulgarian victory");
INSERT INTO "battle" VALUES ("8", "Battle of Adrianople", "1205-04-14", "Kaloyan", "Other Commander", "Bulgarian victory");
INSERT INTO "battle" VALUES ("9", "Battle of Rusion", "1206-03-15", "Other Commander", "Baldwin I", "Latin victory");
INSERT INTO "battle" VALUES ("10", "Battle of Messinopolis", "1207-11-10", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("11", "Battle of Klokotnitsa", "1230-03-09", "Ivan Asen II", "Latin Commander", "Bulgarian victory");
INSERT INTO "battle" VALUES ("12", "Battle of Adrianople", "1205-04-14", "NULL", "Baldwin I", "Unknown");
INSERT INTO "battle" VALUES ("13", "Battle of Thessalonica", "1207-06-01", "Kaloyan", "NULL", "Bulgarian victory");
INSERT INTO "ship" VALUES ("1", "101");
INSERT INTO "ship" VALUES ("4", "102");
INSERT INTO "ship" VALUES ("6", "103");
INSERT INTO "ship" VALUES ("10", "104");
INSERT INTO "ship" VALUES ("2", "105");
INSERT INTO "ship" VALUES ("3", "106");
INSERT INTO "ship" VALUES ("5", "107");