====== pears.CISCard ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Description =====
Construction Industry Scheme Contractor details
===== Columns =====
^ Column ^ Type ^ Null ^ Default ^ Comment ^
| Deleted | smallint | NOT NULL | 0 | |
| TransferBatch | integer | NULL | | |
| DeletedTransferBatch | integer | NULL | | |
| StartDate | date | NOT NULL | | |
| EndDate | date | NULL | | |
| **CISCardID** | char(20) | NOT NULL | | |
| PersonID | char(20) | NOT NULL | | |
| CertificateNumber | char(13) | NOT NULL | | |
| CISType | char(10) | NOT NULL | | |
| ActingFor | char(26) | NOT NULL | | |
| AuthUser | char(16) | NOT NULL | | |
| CreatedBy | char(20) | NULL | | |
| DeletedBy | char(20) | NULL | | |
| WhenEntered | timestamp | NOT NULL | | |
| WhenDeleted | timestamp | NULL | | |
===== Primary Key =====
* CISCardID
===== Foreign Keys =====
^ Constraint ^ Columns ^ References ^ Delete/update action ^
| Person | PersonID | [[database:tables:pears_person|pears.Person (personid)]] | NOT NULL; ON DELETE CASCADE |
| CreatedByStaff | CreatedBy | [[database:tables:pears_staff|pears.staff (staffid)]] | ON DELETE SET NULL |
| DeletedByStaff | DeletedBy | [[database:tables:pears_staff|pears.staff (staffid)]] | ON DELETE SET NULL |
===== Referenced By =====
* No incoming foreign keys found.
===== Indexes =====
^ Name ^ Type ^ Columns ^ Detail ^
| CISTransfer | Index | TransferBatch | |
| CISCardDeletion | Index | DeletedTransferBatch | |
===== Triggers =====
* No triggers found.
===== Original SQL =====
-- IQX database structure split by table
-- Source: IQXDatabaseStructure - with comments.sql
-- Table: "pears"."CISCard"
-- Table comment: Construction Industry Scheme Contractor details
-- Statement count: 7
CREATE TABLE "pears"."CISCard" (
"Deleted" smallint NOT NULL DEFAULT 0
,"TransferBatch" integer NULL
,"DeletedTransferBatch" integer NULL
,"StartDate" date NOT NULL
,"EndDate" date NULL
,"CISCardID" char(20) NOT NULL
,"PersonID" char(20) NOT NULL
,"CertificateNumber" char(13) NOT NULL
,"CISType" char(10) NOT NULL
,"ActingFor" char(26) NOT NULL
,"AuthUser" char(16) NOT NULL
,"CreatedBy" char(20) NULL
,"DeletedBy" char(20) NULL
,"WhenEntered" timestamp NOT NULL
,"WhenDeleted" timestamp NULL
,PRIMARY KEY ("CISCardID" ASC)
)
go
COMMENT ON TABLE "pears"."CISCard" IS
'Construction Industry Scheme Contractor details'
go
ALTER TABLE "pears"."CISCard"
ADD NOT NULL FOREIGN KEY "Person" ("PersonID" ASC)
REFERENCES "pears"."Person" ("personid")
ON DELETE CASCADE
go
ALTER TABLE "pears"."CISCard"
ADD FOREIGN KEY "CreatedByStaff" ("CreatedBy" ASC)
REFERENCES "pears"."staff" ("staffid")
ON DELETE SET NULL
go
ALTER TABLE "pears"."CISCard"
ADD FOREIGN KEY "DeletedByStaff" ("DeletedBy" ASC)
REFERENCES "pears"."staff" ("staffid")
ON DELETE SET NULL
go
CREATE INDEX "CISTransfer" ON "pears"."CISCard"
( "TransferBatch" )
go
CREATE INDEX "CISCardDeletion" ON "pears"."CISCard"
( "DeletedTransferBatch" )
go