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

CREATE TABLE "death" (
"caused_by_ship_id" INT,
"id" INT,
"killed" INT,
"injured" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("caused_by_ship_id") REFERENCES "ship"("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", "victory");
INSERT INTO "battle" VALUES ("2", "defeat");
INSERT INTO "battle" VALUES ("3", "stalemate");
INSERT INTO "battle" VALUES ("4", "victory");
INSERT INTO "battle" VALUES ("5", "defeat");
INSERT INTO "battle" VALUES ("6", "victory");
INSERT INTO "battle" VALUES ("7", "defeat");
INSERT INTO "ship" VALUES ("1", "101");
INSERT INTO "ship" VALUES ("1", "102");
INSERT INTO "ship" VALUES ("2", "201");
INSERT INTO "ship" VALUES ("2", "202");
INSERT INTO "ship" VALUES ("3", "301");
INSERT INTO "ship" VALUES ("4", "401");
INSERT INTO "ship" VALUES ("5", "501");
INSERT INTO "ship" VALUES ("6", "601");
INSERT INTO "ship" VALUES ("7", "701");
INSERT INTO "ship" VALUES ("7", "702");
INSERT INTO "death" VALUES ("101", "1", "100", "50");
INSERT INTO "death" VALUES ("102", "2", "150", "75");
INSERT INTO "death" VALUES ("201", "3", "200", "100");
INSERT INTO "death" VALUES ("202", "4", "50", "25");
INSERT INTO "death" VALUES ("301", "5", "300", "150");
INSERT INTO "death" VALUES ("401", "6", "120", "60");
INSERT INTO "death" VALUES ("501", "7", "80", "40");
INSERT INTO "death" VALUES ("601", "8", "250", "125");
INSERT INTO "death" VALUES ("701", "9", "10", "5");
INSERT INTO "death" VALUES ("702", "10", "500", "250");