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 "Documents" (
"Document_ID" INT UNIQUE,
"Template_ID" INT,
PRIMARY KEY ("Document_ID"),
FOREIGN KEY ("Template_ID") REFERENCES "Templates"("Template_ID")
);

CREATE TABLE "Paragraphs" (
"Paragraph_ID" INT,
"Paragraph_Text" VARCHAR(255),
PRIMARY KEY ("Paragraph_ID")
);

CREATE TABLE "Templates" (
"Template_ID" INT UNIQUE,
"Template_Type_Code" CHAR(15),
PRIMARY KEY ("Template_ID")
);





INSERT INTO "Templates" VALUES ("1", "TypeA");
INSERT INTO "Templates" VALUES ("2", "TypeB");
INSERT INTO "Templates" VALUES ("3", "TypeC");
INSERT INTO "Templates" VALUES ("4", "TypeD");
INSERT INTO "Templates" VALUES ("5", "TypeE");
INSERT INTO "Templates" VALUES ("6", "TypeF");
INSERT INTO "Templates" VALUES ("7", "TypeG");
INSERT INTO "Templates" VALUES ("8", "TypeH");
INSERT INTO "Documents" VALUES ("101", "1");
INSERT INTO "Documents" VALUES ("102", "2");
INSERT INTO "Documents" VALUES ("103", "2");
INSERT INTO "Documents" VALUES ("104", "4");
INSERT INTO "Documents" VALUES ("105", "4");
INSERT INTO "Documents" VALUES ("106", "6");
INSERT INTO "Paragraphs" VALUES ("201", "Introduction to the document.");
INSERT INTO "Paragraphs" VALUES ("202", "Details about the template usage.");
INSERT INTO "Paragraphs" VALUES ("203", "Summary and conclusion.");
INSERT INTO "Paragraphs" VALUES ("204", "Additional notes and remarks.");
INSERT INTO "Paragraphs" VALUES ("205", "Edge case paragraph text.");