pears.PersonShiftPreference

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

Column Type Null Default Comment
PersonShiftPreferenceID char(20) NOT NULL
personid char(20) NOT NULL
TempShiftTemplateID char(20) NULL
companyid char(20) NULL
WhenEntered timestamp NOT NULL current timestamp
WhoEntered char(20) NULL
  • PersonShiftPreferenceID
Constraint Columns References Delete/update action
Person personid pears.Person (personid) NOT NULL; ON DELETE CASCADE
TempShiftTemplate TempShiftTemplateID pears.TempShiftTemplate (TempShiftTemplateID) ON DELETE CASCADE
Company companyid pears.Company (companyid) ON DELETE CASCADE
  • No incoming foreign keys found.
  • No indexes found.
Name Timing Event
PersonShiftPreference_Insert before insert order 1
-- IQX database structure split by table
-- Source: IQXDatabaseStructure - with comments.sql
-- Table: "pears"."PersonShiftPreference"
-- Table comment: 
-- Statement count: 6
 
CREATE TABLE "pears"."PersonShiftPreference" (
    "PersonShiftPreferenceID"        CHAR(20) NOT NULL
   ,"personid"                       CHAR(20) NOT NULL
   ,"TempShiftTemplateID"            CHAR(20) NULL
   ,"companyid"                      CHAR(20) NULL
   ,"WhenEntered"                    TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP
   ,"WhoEntered"                     CHAR(20) NULL
   ,PRIMARY KEY ("PersonShiftPreferenceID" ASC) 
)
GO
 
 
ALTER TABLE "pears"."PersonShiftPreference"
    ADD NOT NULL FOREIGN KEY "Person" ("personid" ASC)
    REFERENCES "pears"."Person" ("personid")
    ON DELETE CASCADE
GO
 
 
ALTER TABLE "pears"."PersonShiftPreference"
    ADD FOREIGN KEY "TempShiftTemplate" ("TempShiftTemplateID" ASC)
    REFERENCES "pears"."TempShiftTemplate" ("TempShiftTemplateID")
    ON DELETE CASCADE
GO
 
 
ALTER TABLE "pears"."PersonShiftPreference"
    ADD FOREIGN KEY "Company" ("companyid" ASC)
    REFERENCES "pears"."Company" ("companyid")
    ON DELETE CASCADE
GO
 
 
CREATE TRIGGER "PersonShiftPreference_Insert" BEFORE INSERT ORDER 1 ON
"pears"."PersonShiftPreference"
REFERENCING NEW AS "new_psp"
FOR each ROW
WHEN("new_psp"."whoentered" IS NULL)
BEGIN
  SET "new_psp"."whoentered" = "userstaffid"
exception
  WHEN others THEN
    SET "new_psp"."whoentered" = NULL
END
GO
 
 
COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."PersonShiftPreference"."PersonShiftPreference_Insert" IS 
{CREATE TRIGGER PersonShiftPreference_Insert 
 BEFORE INSERT ORDER 1 ON
pears.PersonShiftPreference
REFERENCING NEW AS new_psp
FOR each ROW
WHEN(new_psp.whoentered IS NULL)
BEGIN
  SET new_psp.whoentered=userstaffid
exception
  WHEN others THEN
    SET new_psp.whoentered=NULL
END
}
GO
  • database/tables/pears_personshiftpreference.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1