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,
"ANA" INT,
"Diagnosis" TEXT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"DNA" TEXT,
"DNA-II" INT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "Lupus");
INSERT INTO "Patient" VALUES ("2", "Rheumatoid Arthritis");
INSERT INTO "Patient" VALUES ("3", "Sjogrens Syndrome");
INSERT INTO "Patient" VALUES ("4", "Healthy");
INSERT INTO "Patient" VALUES ("5", "Mixed Connective Tissue Disease");
INSERT INTO "Patient" VALUES ("6", "Systemic Sclerosis");
INSERT INTO "Patient" VALUES ("7", "Lupus");
INSERT INTO "Examination" VALUES ("1", "160", "Lupus");
INSERT INTO "Examination" VALUES ("2", "80", "Rheumatoid Arthritis");
INSERT INTO "Examination" VALUES ("3", "320", "Sjogrens Syndrome");
INSERT INTO "Examination" VALUES ("4", "40", "Healthy");
INSERT INTO "Examination" VALUES ("5", "640", "Mixed Connective Tissue Disease");
INSERT INTO "Examination" VALUES ("6", "160", "Systemic Sclerosis");
INSERT INTO "Examination" VALUES ("7", "1280", "Lupus");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "Positive", "10");
INSERT INTO "Laboratory" VALUES ("1", "2023-03-20", "Positive", "12");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-10", "Negative", "5");
INSERT INTO "Laboratory" VALUES ("3", "2023-04-01", "Positive", "9");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-25", "Negative", "3");
INSERT INTO "Laboratory" VALUES ("5", "2023-03-05", "Positive", "15");
INSERT INTO "Laboratory" VALUES ("6", "2023-02-18", "Negative", "7");
INSERT INTO "Laboratory" VALUES ("7", "2023-04-10", "Positive", "8");
INSERT INTO "Laboratory" VALUES ("7", "2023-05-01", "Positive", "11");