{"Ref_Template_Types": {"columns": [[0, "Template_Type_Code", "CHAR(15)", 1, null, 1], [1, "Template_Type_Description", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Template_Type_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Template_Type_Code"]]], "check_constraints": []}, "Templates": {"columns": [[0, "Template_ID", "INTEGER", 1, null, 1], [1, "Version_Number", "INTEGER", 1, null, 0], [2, "Template_Type_Code", "CHAR(15)", 1, null, 0], [3, "Date_Effective_From", "DATETIME", 0, null, 0], [4, "Date_Effective_To", "DATETIME", 0, null, 0], [5, "Template_Details", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Template_ID"], "foreign_keys": [[0, 0, "Ref_Template_Types", "Template_Type_Code", "Template_Type_Code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Documents": {"columns": [[0, "Document_ID", "INTEGER", 1, null, 1], [1, "Template_ID", "INTEGER", 0, null, 0], [2, "Document_Name", "VARCHAR(255)", 0, null, 0], [3, "Document_Description", "VARCHAR(255)", 0, null, 0], [4, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Document_ID"], "foreign_keys": [[0, 0, "Templates", "Template_ID", "Template_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Paragraphs": {"columns": [[0, "Paragraph_ID", "INTEGER", 1, null, 1], [1, "Document_ID", "INTEGER", 1, null, 0], [2, "Paragraph_Text", "VARCHAR(255)", 0, null, 0], [3, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Paragraph_ID"], "foreign_keys": [[0, 0, "Documents", "Document_ID", "Document_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE Ref_Template_Types (
    Template_Type_Code CHAR(15) NOT NULL  PRIMARY KEY,
    Template_Type_Description VARCHAR(255) NOT NULL,
    UNIQUE (Template_Type_Code)
);

CREATE TABLE Templates (
    Template_ID INTEGER NOT NULL  PRIMARY KEY,
    Version_Number INTEGER NOT NULL,
    Template_Type_Code CHAR(15) NOT NULL,
    Date_Effective_From DATETIME,
    Date_Effective_To DATETIME,
    Template_Details VARCHAR(255) NOT NULL,
    FOREIGN KEY (Template_Type_Code) REFERENCES Ref_Template_Types(Template_Type_Code)
);

CREATE TABLE Documents (
    Document_ID INTEGER NOT NULL  PRIMARY KEY,
    Template_ID INTEGER,
    Document_Name VARCHAR(255),
    Document_Description VARCHAR(255),
    Other_Details VARCHAR(255),
    FOREIGN KEY (Template_ID) REFERENCES Templates(Template_ID)
);

CREATE TABLE Paragraphs (
    Paragraph_ID INTEGER NOT NULL  PRIMARY KEY,
    Document_ID INTEGER NOT NULL,
    Paragraph_Text VARCHAR(255),
    Other_Details VARCHAR(255),
    FOREIGN KEY (Document_ID) REFERENCES Documents(Document_ID)
);