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", "Henry of Flanders", "Bulgarian victory");
INSERT INTO "battle" VALUES ("3", "Battle of Philippopolis", "1208-09-15", "Boril", "Baldwin I", "Latin victory");
INSERT INTO "battle" VALUES ("4", "Battle of Rusion", "1206-07-20", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("5", "Battle of Messinopolis", "1207-09-04", "Kaloyan", "Henry of Flanders", "Bulgarian victory");
INSERT INTO "battle" VALUES ("6", "Battle of Klokotnitsa", "1230-03-09", "Ivan Asen II", "Theodore Komnenos", "Bulgarian victory");
INSERT INTO "battle" VALUES ("7", "Battle of Adrianople", "1205-04-14", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("8", "Battle of Rusion", "1206-07-20", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("9", "Battle of Adrianople", "1205-04-14", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("10", "Battle of Rusion", "1206-07-20", "Kaloyan", "Baldwin I", "Bulgarian victory");
INSERT INTO "ship" VALUES ("1", "101");
INSERT INTO "ship" VALUES ("1", "102");
INSERT INTO "ship" VALUES ("4", "103");
INSERT INTO "ship" VALUES ("4", "104");
INSERT INTO "ship" VALUES ("3", "105");
INSERT INTO "ship" VALUES ("2", "106");
INSERT INTO "ship" VALUES ("5", "107");
INSERT INTO "ship" VALUES ("6", "108");
INSERT INTO "ship" VALUES ("7", "109");
INSERT INTO "ship" VALUES ("8", "110");