pears.TSQueryHistory

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

Record of changes to Timesheet Queries

Column Type Null Default Comment
TSQueryHistoryID char(20) NOT NULL
TSQueryLogID char(20) NOT NULL
WhenEntered timestamp NULL current timestamp
WhoEntered char(20) NULL
Notes long varchar NULL
OldStatus char(1) NULL
NewStatus char(1) NULL
  • TSQueryHistoryID
Constraint Columns References Delete/update action
TSQueryLog TSQueryLogID pears.TSQueryLog (TSQueryLogID) NOT NULL;
  • No incoming foreign keys found.
  • No indexes found.
Name Timing Event
TSQueryHistoryinsert before insert order 1
-- IQX database structure split by table
-- Source: IQXDatabaseStructure - with comments.sql
-- Table: "pears"."TSQueryHistory"
-- Table comment: Record of changes to Timesheet Queries
-- Statement count: 5
 
CREATE TABLE "pears"."TSQueryHistory" (
    "TSQueryHistoryID"               CHAR(20) NOT NULL
   ,"TSQueryLogID"                   CHAR(20) NOT NULL
   ,"WhenEntered"                    TIMESTAMP NULL DEFAULT CURRENT TIMESTAMP
   ,"WhoEntered"                     CHAR(20) NULL
   ,"Notes"                          long VARCHAR NULL
   ,"OldStatus"                      CHAR(1) NULL
   ,"NewStatus"                      CHAR(1) NULL
   ,PRIMARY KEY ("TSQueryHistoryID" ASC) 
)
GO
 
 
COMMENT ON TABLE "pears"."TSQueryHistory" IS 
	'Record of changes to Timesheet Queries'
GO
 
 
ALTER TABLE "pears"."TSQueryHistory"
    ADD NOT NULL FOREIGN KEY "TSQueryLog" ("TSQueryLogID" ASC)
    REFERENCES "pears"."TSQueryLog" ("TSQueryLogID")
GO
 
 
CREATE TRIGGER "TSQueryHistoryinsert" BEFORE INSERT ORDER 1 ON
"pears"."TSQueryHistory"
REFERENCING NEW AS "new_tsq"
FOR each ROW
WHEN("new_tsq"."WhoEntered" IS NULL)
BEGIN
  SET "new_tsq"."WhoEntered" = "userstaffid"
exception
  WHEN others THEN
    SET "new_tsq"."WhoEntered" = NULL
END
GO
 
 
COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."TSQueryHistory"."TSQueryHistoryinsert" IS 
{CREATE TRIGGER TSQueryHistoryinsert 
 BEFORE INSERT ORDER 1 ON
pears.TSQueryHistory
REFERENCING NEW AS new_tsq
FOR each ROW
WHEN(new_tsq.WhoEntered IS NULL)
BEGIN
  SET new_tsq.WhoEntered=userstaffid
exception
  WHEN others THEN
    SET new_tsq.WhoEntered=NULL
END
}
GO
  • database/tables/pears_tsqueryhistory.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1