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

CREATE TABLE "Paragraphs" (
"Paragraph_ID" INT,
"Document_ID" INT,
PRIMARY KEY ("Paragraph_ID"),
FOREIGN KEY ("Document_ID") REFERENCES "Documents"("Document_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,
"Template_Details" VARCHAR(255),
PRIMARY KEY ("Template_ID")
);





INSERT INTO "Documents" VALUES ("1", "Summer Show");
INSERT INTO "Documents" VALUES ("2", "Winter Gala");
INSERT INTO "Documents" VALUES ("3", "Spring Festival");
INSERT INTO "Documents" VALUES ("4", "Autumn Ball");
INSERT INTO "Documents" VALUES ("5", "Summer Show Extended");
INSERT INTO "Paragraphs" VALUES ("101", "1");
INSERT INTO "Paragraphs" VALUES ("102", "1");
INSERT INTO "Paragraphs" VALUES ("103", "1");
INSERT INTO "Paragraphs" VALUES ("104", "1");
INSERT INTO "Paragraphs" VALUES ("105", "1");
INSERT INTO "Paragraphs" VALUES ("106", "2");
INSERT INTO "Paragraphs" VALUES ("107", "2");
INSERT INTO "Paragraphs" VALUES ("108", "3");
INSERT INTO "Paragraphs" VALUES ("109", "3");
INSERT INTO "Paragraphs" VALUES ("110", "3");
INSERT INTO "Paragraphs" VALUES ("111", "4");
INSERT INTO "Paragraphs" VALUES ("112", "5");
INSERT INTO "Paragraphs" VALUES ("113", "5");
INSERT INTO "Paragraphs" VALUES ("114", "5");
INSERT INTO "Paragraphs" VALUES ("115", "5");
INSERT INTO "Paragraphs" VALUES ("116", "5");
INSERT INTO "Paragraphs" VALUES ("117", "5");
INSERT INTO "Paragraphs" VALUES ("118", "5");
INSERT INTO "Ref_Template_Types" VALUES ("TT001", "Header");
INSERT INTO "Ref_Template_Types" VALUES ("TT002", "Footer");
INSERT INTO "Ref_Template_Types" VALUES ("TT003", "Body");
INSERT INTO "Ref_Template_Types" VALUES ("TT004", "Title");
INSERT INTO "Ref_Template_Types" VALUES ("TT005", "Summary");
INSERT INTO "Templates" VALUES ("201", "Standard Header");
INSERT INTO "Templates" VALUES ("202", "Standard Footer");
INSERT INTO "Templates" VALUES ("203", "Body Text");
INSERT INTO "Templates" VALUES ("204", "Title Style");
INSERT INTO "Templates" VALUES ("205", "Summary Style");