====== 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 =====
* DocumentTagID
===== Foreign Keys =====
^ Constraint ^ Columns ^ References ^ Delete/update action ^
| DocumentType | DocumentTypeID | [[database:tables:pears_documenttype|pears.DocumentType (DocumentTypeID)]] | ON DELETE CASCADE |
| TagKey | TagLocation, TagID | [[database:tables:pears_tag|pears.tag (taglocation, tagid)]] | NOT NULL; ON DELETE CASCADE |
===== Referenced By =====
* No incoming foreign keys found.
===== Indexes =====
* No indexes found.
===== Triggers =====
* No triggers found.
===== 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