Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
User defined shift cancellation reason with settings for action required.
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
| TempShiftCancelReasonID | char(1) | NOT NULL | ||
| Name | char(50) | NOT NULL | ||
| SortOrder | smallint | NULL | ||
| AppliesToUnfilled | tinyint | NULL | ||
| ClientAware | tinyint | NULL | ||
| TempAware | tinyint | NULL | ||
| Bill | tinyint | NULL | ||
| Pay | tinyint | NULL | ||
| Refill | tinyint | NULL | ||
| PublishToWeb | smallint | NULL | 0 | |
| ShortCode | char(4) | NULL | ||
| TempShiftUnavailable | tinyint | NULL |
| Table | Constraint | Columns | Referenced columns |
|---|---|---|---|
| pears.PlacementDayVariation | TempShiftCancelReason | TempShiftCancelReasonID | TempShiftCancelReasonID |
| pears.TempShift | TempShiftCancelReason | CancelReason | TempShiftCancelReasonID |
| pears.TempShiftCancelReasonDept | TempShiftCancelReason | TempShiftCancelReasonid | TempShiftCancelReasonID |
| Name | Timing | Event |
|---|---|---|
| WPK_tempshiftcancelreason_SHIFTCANCELREASON | after | insert,delete,update order 1 |
| TempShiftCancelReasonAudit | before | delete order 1 |
-- IQX database structure split by table -- Source: IQXDatabaseStructure - with comments.sql -- Table: "pears"."TempShiftCancelReason" -- Table comment: User defined shift cancellation reason with settings for action required. -- Statement count: 6 CREATE TABLE "pears"."TempShiftCancelReason" ( "TempShiftCancelReasonID" CHAR(1) NOT NULL ,"Name" CHAR(50) NOT NULL ,"SortOrder" SMALLINT NULL ,"AppliesToUnfilled" tinyint NULL ,"ClientAware" tinyint NULL ,"TempAware" tinyint NULL ,"Bill" tinyint NULL ,"Pay" tinyint NULL ,"Refill" tinyint NULL ,"PublishToWeb" SMALLINT NULL DEFAULT 0 ,"ShortCode" CHAR(4) NULL ,"TempShiftUnavailable" tinyint NULL ,PRIMARY KEY ("TempShiftCancelReasonID" ASC) ) GO COMMENT ON TABLE "pears"."TempShiftCancelReason" IS 'User defined shift cancellation reason with settings for action required.' GO CREATE TRIGGER "WPK_tempshiftcancelreason_SHIFTCANCELREASON" after INSERT,DELETE,UPDATE ORDER 1 ON "pears"."tempshiftcancelreason" FOR each statement BEGIN CALL "WPKTrackChange"('P','SHIFTCANCELREASON') END GO COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."TempShiftCancelReason"."WPK_tempshiftcancelreason_SHIFTCANCELREASON" IS {CREATE TRIGGER WPK_tempshiftcancelreason_SHIFTCANCELREASON after INSERT,DELETE,UPDATE ORDER 1 ON tempshiftcancelreason FOR each statement BEGIN CALL WPKTrackChange('P','SHIFTCANCELREASON') END } GO CREATE TRIGGER "TempShiftCancelReasonAudit" BEFORE DELETE ORDER 1 ON "pears"."TempShiftCancelReason" REFERENCING OLD AS "old_shiftcancelreason" FOR each ROW BEGIN DECLARE "mergedid" CHAR(1); DECLARE "nameold" CHAR(50); DECLARE "mergedname" CHAR(50); SET "mergedid" = (SELECT "RIGHT"("old_shiftcancelreason"."name",1)); SET "nameold" = (SELECT "LEFT"("old_shiftcancelreason"."name","LEN"("old_shiftcancelreason"."name")-1)); SET "mergedname" = (SELECT "name" FROM "tempshiftcancelreason" WHERE "tempshiftcancelreasonid" = "mergedid"); IF EXISTS(SELECT * FROM "audititems" WHERE "isnull"("auditflag",0) = 1 AND "itemname" = 'Cancel Reason') THEN CALL "auditlog"('Shift',"old_shiftcancelreason"."tempshiftcancelreasonid", 'Shift Cancel Reason deleted',"nameold",'Removed - Merged into '+"mergedid"+' - '+"mergedname") END IF END GO COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."TempShiftCancelReason"."TempShiftCancelReasonAudit" IS {CREATE TRIGGER TempShiftCancelReasonAudit BEFORE DELETE ORDER 1 ON pears.TempShiftCancelReason REFERENCING OLD AS old_shiftcancelreason FOR each ROW BEGIN DECLARE mergedid CHAR(1); DECLARE nameold CHAR(50); DECLARE mergedname CHAR(50); SET mergedid = (SELECT RIGHT(old_shiftcancelreason.name, 1)); SET nameold = (SELECT LEFT(old_shiftcancelreason.name, LEN(old_shiftcancelreason.name) - 1)); SET mergedname = (SELECT name FROM tempshiftcancelreason WHERE tempshiftcancelreasonid = mergedid) ; IF EXISTS(SELECT * FROM audititems WHERE isnull(auditflag, 0) = 1 AND itemname= 'Cancel Reason') THEN CALL auditlog('Shift',old_shiftcancelreason.tempshiftcancelreasonid , 'Shift Cancel Reason deleted',nameold,'Removed - Merged into '+mergedid+' - '+mergedname) END IF; END } GO