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 "Examination" (
"ID" INT,
"aCL IgM" FLOAT,
"ANA Pattern" TEXT,
"Thrombosis" INT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"APTT" INT,
"IGM" INT,
PRIMARY KEY ("ID", "Date")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "Diagnosis A");
INSERT INTO "Patient" VALUES ("2", "Diagnosis B");
INSERT INTO "Patient" VALUES ("3", "Diagnosis C");
INSERT INTO "Patient" VALUES ("4", "Diagnosis D");
INSERT INTO "Patient" VALUES ("5", "Diagnosis E");
INSERT INTO "Patient" VALUES ("6", "Diagnosis F");
INSERT INTO "Patient" VALUES ("7", "Diagnosis G");
INSERT INTO "Patient" VALUES ("8", "Diagnosis H");
INSERT INTO "Examination" VALUES ("1", "10.0", "S", "2");
INSERT INTO "Examination" VALUES ("2", "15.0", "S", "2");
INSERT INTO "Examination" VALUES ("3", "12.0", "S", "1");
INSERT INTO "Examination" VALUES ("4", "20.0", "S", "2");
INSERT INTO "Examination" VALUES ("5", "18.0", "N", "2");
INSERT INTO "Examination" VALUES ("6", "14.0", "S", "3");
INSERT INTO "Examination" VALUES ("7", "16.0", "S", "2");
INSERT INTO "Examination" VALUES ("8", "11.0", "S", "2");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-01", "30", "5");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-02", "28", "7");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-03", "32", "6");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-04", "29", "8");
INSERT INTO "Laboratory" VALUES ("5", "2024-01-05", "31", "4");
INSERT INTO "Laboratory" VALUES ("6", "2024-01-06", "27", "5");
INSERT INTO "Laboratory" VALUES ("7", "2024-01-07", "33", "7");
INSERT INTO "Laboratory" VALUES ("8", "2024-01-08", "30", "6");