Table of Contents



pears.PayrollDocument

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

Description

Links to payroll PDF documents in the blobstore (class P)

Columns

Column Type Null Default Comment
PayrollDocumentID char(20) NOT NULL =blobstore.id where blobstore.class=P
DocumentType char(12) NOT NULL Payslip, P45, P60
PayrollCompanyID char(1) NOT NULL
PeriodLength char(1) NULL
Year integer NULL
Period integer NULL
PayrollNumber char(20) NOT NULL
PersonID char(20) NOT NULL
WhenEntered timestamp NULL current timestamp

Primary Key

Foreign Keys

Constraint Columns References Delete/update action
Person PersonID pears.Person (personid) NOT NULL; ON DELETE CASCADE

Referenced By

Indexes

Name Type Columns Detail
PayrollDocumentPayrollNumber Index PayrollNumber, DocumentType

Triggers

Original SQL

-- IQX database structure split by table
-- Source: IQXDatabaseStructure - with comments.sql
-- Table: "pears"."PayrollDocument"
-- Table comment: Links to payroll PDF documents in the blobstore (class P)
-- Statement count: 6
 
CREATE TABLE "pears"."PayrollDocument" (
    "PayrollDocumentID"              CHAR(20) NOT NULL
   ,"DocumentType"                   CHAR(12) NOT NULL
   ,"PayrollCompanyID"               CHAR(1) NOT NULL
   ,"PeriodLength"                   CHAR(1) NULL
   ,"Year"                           INTEGER NULL
   ,"Period"                         INTEGER NULL
   ,"PayrollNumber"                  CHAR(20) NOT NULL
   ,"PersonID"                       CHAR(20) NOT NULL
   ,"WhenEntered"                    TIMESTAMP NULL DEFAULT CURRENT TIMESTAMP
   ,PRIMARY KEY ("PayrollDocumentID" ASC) 
)
GO
 
 
COMMENT ON COLUMN "pears"."PayrollDocument"."PayrollDocumentID" IS 
	'=blobstore.id where blobstore.class=P'
GO
 
 
COMMENT ON COLUMN "pears"."PayrollDocument"."DocumentType" IS 
	'Payslip, P45, P60'
GO
 
 
COMMENT ON TABLE "pears"."PayrollDocument" IS 
	'Links to payroll PDF documents in the blobstore (class P)'
GO
 
 
ALTER TABLE "pears"."PayrollDocument"
    ADD NOT NULL FOREIGN KEY "Person" ("PersonID" ASC)
    REFERENCES "pears"."Person" ("personid")
    ON DELETE CASCADE
GO
 
 
CREATE INDEX "PayrollDocumentPayrollNumber" ON "pears"."PayrollDocument"
    ( "PayrollNumber","DocumentType" )
GO