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 ("101", "Introduction to the document.");
INSERT INTO "Paragraphs" VALUES ("102", "Summary of the main points.");
INSERT INTO "Paragraphs" VALUES ("103", "Detailed analysis and discussion.");
INSERT INTO "Paragraphs" VALUES ("104", "Conclusion and recommendations.");
INSERT INTO "Paragraphs" VALUES ("105", "Appendix and references.");
INSERT INTO "Ref_Template_Types" VALUES ("PP", "PowerPoint Presentation");
INSERT INTO "Ref_Template_Types" VALUES ("PPT", "PowerPoint Template");
INSERT INTO "Ref_Template_Types" VALUES ("PPTX", "PowerPoint Extended Template");
INSERT INTO "Ref_Template_Types" VALUES ("DOC", "Word Document Template");
INSERT INTO "Ref_Template_Types" VALUES ("PDF", "PDF Document Template");
INSERT INTO "Ref_Template_Types" VALUES ("", "Unknown Template Type");
INSERT INTO "Ref_Template_Types" VALUES ("PPX", "PowerPoint Extra");
INSERT INTO "Ref_Template_Types" VALUES ("PPTT", "PowerPoint Template Test");
INSERT INTO "Templates" VALUES ("1001", "PP");
INSERT INTO "Templates" VALUES ("1002", "PPT");
INSERT INTO "Templates" VALUES ("1003", "DOC");
INSERT INTO "Templates" VALUES ("1004", "PDF");
INSERT INTO "Templates" VALUES ("1005", "PP");
INSERT INTO "Templates" VALUES ("1006", "PPT");
INSERT INTO "Templates" VALUES ("1007", "PPTX");
INSERT INTO "Templates" VALUES ("1008", "PPX");
INSERT INTO "Templates" VALUES ("1009", "PPTT");
INSERT INTO "Templates" VALUES ("1010", "");
INSERT INTO "Templates" VALUES ("1011", "PP");
INSERT INTO "Templates" VALUES ("1012", "PPT");
INSERT INTO "Templates" VALUES ("1013", "PP");
INSERT INTO "Templates" VALUES ("1014", "DOC");
INSERT INTO "Templates" VALUES ("1015", "");