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 UNIQUE,
"name" TEXT,
"bulgarian_commander" TEXT,
"result" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "death" (
"caused_by_ship_id" INT,
"id" INT,
"killed" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("caused_by_ship_id") REFERENCES "ship"("id")
);

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





INSERT INTO "battle" VALUES ("1", "Battle of Dover Strait", "Commander Ivanov", "Victory");
INSERT INTO "battle" VALUES ("2", "Battle of the North Sea", "Commander Petrov", "Defeat");
INSERT INTO "battle" VALUES ("3", "Battle of the English Channel", "Commander Dimitrov", "Stalemate");
INSERT INTO "battle" VALUES ("4", "Battle of Calais", "Commander Georgiev", "Victory");
INSERT INTO "battle" VALUES ("5", "Battle of the Atlantic", "Commander Nikolov", "Defeat");
INSERT INTO "ship" VALUES ("1", "101", "Destroyer", "North Sea");
INSERT INTO "ship" VALUES ("2", "102", "Frigate", "English Channel");
INSERT INTO "ship" VALUES ("3", "103", "Cruiser", "Baltic Sea");
INSERT INTO "ship" VALUES ("0", "104", "Battleship", "English Channel");
INSERT INTO "ship" VALUES ("5", "105", "Submarine", "Atlantic Ocean");
INSERT INTO "death" VALUES ("101", "201", "20");
INSERT INTO "death" VALUES ("102", "202", "15");
INSERT INTO "death" VALUES ("103", "203", "30");
INSERT INTO "death" VALUES ("105", "204", "10");