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

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

CREATE TABLE "Ref_Template_Types" (
"Template_Type_Code" CHAR(15),
"Template_Type_Description" VARCHAR(255),
PRIMARY KEY ("Template_Type_Code")
);

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





INSERT INTO "Documents" VALUES ("1");
INSERT INTO "Documents" VALUES ("2");
INSERT INTO "Documents" VALUES ("3");
INSERT INTO "Documents" VALUES ("4");
INSERT INTO "Documents" VALUES ("5");
INSERT INTO "Paragraphs" VALUES ("1", "This is the introduction paragraph.");
INSERT INTO "Paragraphs" VALUES ("2", "This paragraph describes the main content.");
INSERT INTO "Paragraphs" VALUES ("3", "Conclusion paragraph with summary.");
INSERT INTO "Paragraphs" VALUES ("4", "Additional notes and disclaimers.");
INSERT INTO "Paragraphs" VALUES ("5", "References and acknowledgments.");
INSERT INTO "Ref_Template_Types" VALUES ("CV", "Curriculum Vitae");
INSERT INTO "Ref_Template_Types" VALUES ("LTR", "Letter");
INSERT INTO "Ref_Template_Types" VALUES ("RPT", "Report");
INSERT INTO "Ref_Template_Types" VALUES ("MEMO", "Memorandum");
INSERT INTO "Ref_Template_Types" VALUES ("AGRMNT", "Agreement");
INSERT INTO "Templates" VALUES ("101", "CV");
INSERT INTO "Templates" VALUES ("102", "CV");
INSERT INTO "Templates" VALUES ("103", "LTR");
INSERT INTO "Templates" VALUES ("104", "RPT");
INSERT INTO "Templates" VALUES ("105", "CV");
INSERT INTO "Templates" VALUES ("106", "MEMO");
INSERT INTO "Templates" VALUES ("107", "AGRMNT");
INSERT INTO "Templates" VALUES ("108", "CV");
INSERT INTO "Templates" VALUES ("109", "LTR");
INSERT INTO "Templates" VALUES ("110", "RPT");