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 first paragraph of the document.");
INSERT INTO "Paragraphs" VALUES ("2", "Introduction to the template types.");
INSERT INTO "Paragraphs" VALUES ("3", "Details about the PP template type.");
INSERT INTO "Paragraphs" VALUES ("4", "Details about the PPT template type.");
INSERT INTO "Paragraphs" VALUES ("5", "Summary and conclusion.");
INSERT INTO "Ref_Template_Types" VALUES ("PP", "PowerPoint Presentation");
INSERT INTO "Ref_Template_Types" VALUES ("PPT", "Portable Presentation Template");
INSERT INTO "Ref_Template_Types" VALUES ("DOC", "Word Document Template");
INSERT INTO "Ref_Template_Types" VALUES ("XLS", "Excel Spreadsheet Template");
INSERT INTO "Ref_Template_Types" VALUES ("PDF", "PDF Document Template");
INSERT INTO "Templates" VALUES ("101", "PP");
INSERT INTO "Templates" VALUES ("102", "PPT");
INSERT INTO "Templates" VALUES ("103", "DOC");
INSERT INTO "Templates" VALUES ("104", "XLS");
INSERT INTO "Templates" VALUES ("105", "PP");
INSERT INTO "Templates" VALUES ("106", "PPT");
INSERT INTO "Templates" VALUES ("107", "PDF");