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

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

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





INSERT INTO "battle" VALUES ("1");
INSERT INTO "battle" VALUES ("2");
INSERT INTO "battle" VALUES ("3");
INSERT INTO "battle" VALUES ("4");
INSERT INTO "battle" VALUES ("5");
INSERT INTO "ship" VALUES ("1", "101", "Sunk");
INSERT INTO "ship" VALUES ("1", "102", "Captured");
INSERT INTO "ship" VALUES ("2", "103", "Sunk");
INSERT INTO "ship" VALUES ("2", "104", "Captured");
INSERT INTO "ship" VALUES ("3", "105", "Scuttled");
INSERT INTO "ship" VALUES ("3", "106", "Captured");
INSERT INTO "ship" VALUES ("4", "107", "Sunk");
INSERT INTO "ship" VALUES ("4", "108", "Survived");
INSERT INTO "ship" VALUES ("5", "109", "Captured");
INSERT INTO "ship" VALUES ("5", "110", "Survived");
INSERT INTO "ship" VALUES ("NULL", "111", "Captured");
INSERT INTO "ship" VALUES ("NULL", "112", "Survived");
INSERT INTO "death" VALUES ("101", "1");
INSERT INTO "death" VALUES ("103", "2");
INSERT INTO "death" VALUES ("105", "3");
INSERT INTO "death" VALUES ("107", "4");