====== 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 ===== * PayrollDocumentID ===== Foreign Keys ===== ^ Constraint ^ Columns ^ References ^ Delete/update action ^ | Person | PersonID | [[database:tables:pears_person|pears.Person (personid)]] | NOT NULL; ON DELETE CASCADE | ===== Referenced By ===== * No incoming foreign keys found. ===== Indexes ===== ^ Name ^ Type ^ Columns ^ Detail ^ | PayrollDocumentPayrollNumber | Index | PayrollNumber, DocumentType | | ===== Triggers ===== * No triggers found. ===== 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