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" (
"ANA" INT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"RA" TEXT,
"RNP" TEXT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "M", "1986-05-20", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "F", "1984-12-15", "Lupus");
INSERT INTO "Patient" VALUES ("3", "F", "1990-07-30", "Arthritis");
INSERT INTO "Patient" VALUES ("4", "M", "1987-11-05", "Vasculitis");
INSERT INTO "Patient" VALUES ("5", "F", "1983-03-22", "Fibromyalgia");
INSERT INTO "Patient" VALUES ("6", "M", "1992-01-10", "Scleroderma");
INSERT INTO "Patient" VALUES ("7", "F", "1989-09-17", "Raynaud's Phenomenon");
INSERT INTO "Patient" VALUES ("8", "M", "1985-01-01", "Mixed Connective Tissue Disease");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "-", "Positive");
INSERT INTO "Laboratory" VALUES ("1", "2023-06-20", "+-", "Negative");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-10", "++", "Positive");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-05", "-", "Negative");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-12", "+-", "Positive");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-18", "++", "Negative");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-22", "-", "Positive");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-30", "+-", "Negative");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-15", "++", "Positive");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");