====== pears.AuditItems ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Description ===== Controls which items are included in auditing. ===== Columns ===== ^ Column ^ Type ^ Null ^ Default ^ Comment ^ | **AuditItemID** | char(20) | NOT NULL | | | | AreaName | char(250) | NOT NULL | | | | ItemName | char(250) | NOT NULL | | | | AuditFlag | smallint | NULL | | | | SortOrder | smallint | NULL | 0 | | | Notes | char(200) | NULL | | | ===== Primary Key ===== * AuditItemID ===== Foreign Keys ===== * No outgoing foreign keys found. ===== Referenced By ===== * No incoming foreign keys found. ===== Indexes ===== ^ Name ^ Type ^ Columns ^ Detail ^ | AuditItemsName | Index | AreaName, SortOrder, ItemName | | ===== Triggers ===== ^ Name ^ Timing ^ Event ^ | AuditItemsAudit | before | update of "AuditFlag" order 1 | ===== Original SQL ===== -- IQX database structure split by table -- Source: IQXDatabaseStructure - with comments.sql -- Table: "pears"."AuditItems" -- Table comment: Controls which items are included in auditing. -- Statement count: 5 CREATE TABLE "pears"."AuditItems" ( "AuditItemID" char(20) NOT NULL ,"AreaName" char(250) NOT NULL ,"ItemName" char(250) NOT NULL ,"AuditFlag" smallint NULL ,"SortOrder" smallint NULL DEFAULT 0 ,"Notes" char(200) NULL ,PRIMARY KEY ("AuditItemID" ASC) ) go COMMENT ON TABLE "pears"."AuditItems" IS 'Controls which items are included in auditing.' go CREATE INDEX "AuditItemsName" ON "pears"."AuditItems" ( "AreaName","SortOrder","ItemName" ) go create trigger "AuditItemsAudit" before update of "AuditFlag" order 1 on "pears"."AuditItems" referencing old as "old_ai" new as "new_ai" for each row begin call "AuditLog"('AUDIT',"old_ai"."AuditItemID","string"('Audit Updated - ',"old_ai"."AreaName",' ',"old_ai"."ItemName"),"old_ai"."AuditFlag","new_ai"."AuditFlag") end go COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."AuditItems"."AuditItemsAudit" IS {create trigger AuditItemsAudit before update of AuditFlag, order 1 on pears.AuditItems referencing old as old_ai new as new_ai for each row begin call AuditLog('AUDIT',old_ai.AuditItemID,string('Audit Updated - ',old_ai.AreaName,' ',old_ai.ItemName),old_ai.AuditFlag,new_ai.AuditFlag) end } go