Table of Contents



pears.DocumentTag

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

Description

Questions (ie TagIDs) associated with a Document Type for Compliance Documents

Columns

Column Type Null Default Comment
DocumentTagID char(20) NOT NULL
DocumentTypeID char(20) NULL
TagID char(3) NULL
TagLocation char(3) NULL
Required smallint NULL
DeleteOnArchive smallint NULL

Primary Key

Foreign Keys

Constraint Columns References Delete/update action
DocumentType DocumentTypeID pears.DocumentType (DocumentTypeID) ON DELETE CASCADE
TagKey TagLocation, TagID pears.tag (taglocation, tagid) NOT NULL; ON DELETE CASCADE

Referenced By

Indexes

Triggers

Original SQL

-- IQX database structure split by table
-- Source: IQXDatabaseStructure - with comments.sql
-- Table: "pears"."DocumentTag"
-- Table comment: Questions (ie TagIDs) associated with a Document Type for Compliance Documents
-- Statement count: 4
 
CREATE TABLE "pears"."DocumentTag" (
    "DocumentTagID"                  CHAR(20) NOT NULL
   ,"DocumentTypeID"                 CHAR(20) NULL
   ,"TagID"                          CHAR(3) NULL
   ,"TagLocation"                    CHAR(3) NULL
   ,"Required"                       SMALLINT NULL
   ,"DeleteOnArchive"                SMALLINT NULL
   ,PRIMARY KEY ("DocumentTagID" ASC) 
)
GO
 
 
COMMENT ON TABLE "pears"."DocumentTag" IS 
	'Questions (ie TagIDs) associated with a Document Type for Compliance Documents'
GO
 
 
ALTER TABLE "pears"."DocumentTag"
    ADD FOREIGN KEY "DocumentType" ("DocumentTypeID" ASC)
    REFERENCES "pears"."DocumentType" ("DocumentTypeID")
    ON DELETE CASCADE
GO
 
 
ALTER TABLE "pears"."DocumentTag"
    ADD NOT NULL FOREIGN KEY "TagKey" ("TagLocation" ASC,"TagID" ASC)
    REFERENCES "pears"."tag" ("taglocation","tagid")
    ON DELETE CASCADE
GO