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,
PRIMARY KEY ("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 UNIQUE,
"Version_Number" INT,
"Template_Type_Code" CHAR(15),
"Date_Effective_From" DATETIME,
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 "Ref_Template_Types" VALUES ("TYPE_A", "Standard Contract");
INSERT INTO "Ref_Template_Types" VALUES ("TYPE_B", "NDA Agreement");
INSERT INTO "Ref_Template_Types" VALUES ("TYPE_C", "Employment Offer");
INSERT INTO "Ref_Template_Types" VALUES ("TYPE_D", "Service Level Agreement");
INSERT INTO "Ref_Template_Types" VALUES ("TYPE_E", "Confidentiality Agreement");
INSERT INTO "Templates" VALUES ("101", "1", "TYPE_A", "2023-01-01 00:00:00");
INSERT INTO "Templates" VALUES ("102", "2", "TYPE_A", "2023-06-01 00:00:00");
INSERT INTO "Templates" VALUES ("103", "1", "TYPE_B", "2022-12-15 00:00:00");
INSERT INTO "Templates" VALUES ("104", "3", "TYPE_B", "2023-07-01 00:00:00");
INSERT INTO "Templates" VALUES ("105", "1", "TYPE_C", "2023-03-10 00:00:00");
INSERT INTO "Templates" VALUES ("106", "2", "TYPE_C", "2023-08-20 00:00:00");
INSERT INTO "Templates" VALUES ("107", "1", "TYPE_D", "2022-11-05 00:00:00");
INSERT INTO "Templates" VALUES ("108", "1", "TYPE_E", "2023-05-15 00:00:00");
INSERT INTO "Templates" VALUES ("109", "2", "TYPE_E", "2023-09-01 00:00:00");
INSERT INTO "Templates" VALUES ("110", "1", "TYPE_A", "2024-01-01 00:00:00");