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", "378-08-09", "Fritigern", "Valens", "Decisive Gothic victory");
INSERT INTO "battle" VALUES ("2", "Battle of Marcianople", "376-00-00", "Fritigern", "Lupicinus", "Gothic victory");
INSERT INTO "battle" VALUES ("3", "Battle of the Frigidus", "394-09-06", "Theodosius I", "Eugenius", "Roman victory");
INSERT INTO "battle" VALUES ("4", "Battle of the Catalaunian Plains", "451-06-20", "Attila", "Aetius", "Roman/Visigothic victory");
INSERT INTO "battle" VALUES ("5", "Battle of Vouillé", "507-00-00", "Alaric II", "Clovis I", "Frankish victory");
INSERT INTO "battle" VALUES ("6", "Battle of Taginae", "552-07-01", "Totila", "Narses", "Byzantine victory");
INSERT INTO "battle" VALUES ("7", "Battle of Yarmouk", "636-08-00", "Khalid ibn al-Walid", "Theodore Trithyrius", "Rashidun victory");
INSERT INTO "battle" VALUES ("8", "Battle of Tours", "732-10-10", "Abd al-Rahman al-Ghafiqi", "Charles Martel", "Frankish victory");
INSERT INTO "battle" VALUES ("9", "Battle of Pliska", "811-07-26", "Krum", "Nikephoros I", "Bulgarian victory");
INSERT INTO "battle" VALUES ("10", "Battle of Kleidion", "1014-07-29", "Samuel of Bulgaria", "Basil II", "Byzantine victory");
INSERT INTO "ship" VALUES ("1", "101");
INSERT INTO "ship" VALUES ("1", "102");
INSERT INTO "ship" VALUES ("3", "103");
INSERT INTO "ship" VALUES ("5", "104");
INSERT INTO "ship" VALUES ("7", "105");
INSERT INTO "ship" VALUES ("9", "106");
INSERT INTO "ship" VALUES ("10", "107");
INSERT INTO "ship" VALUES ("2", "108");
INSERT INTO "ship" VALUES ("4", "109");
INSERT INTO "ship" VALUES ("6", "110");