FinanceFerret/2.0/sql/event

From Woozle Writes Code
< FinanceFerret‎ | 2.0‎ | sql
Jump to navigation Jump to search

About

  • Version: Copied, with only slight changes, from the event table in VbzCart (which later became part of Ferreteria's event-logging system which has since been redesigned). This version is suitable for re-use in other projects, but perhaps should be renamed EventLog or Events because the MySQL syntax highlighter thinks "log" is a keyword.
    • 2009-08-30: suggest LogEvent ("Log" as prefix so all log tables are together, type of log as singular)
  • Fields:
    • isError: FALSE = this is just a message or normal event; TRUE = there is a problem to fix (error)
  • Notes
    • Have to use "Ev" prefix for field names that would otherwise be keywords: When, Where
    • "Code" doesn't seem to be getting any use, but leaving it in for now
  • History:
    • 2010-03-31 Making changes based on changes to VbzCart/tables/event log, since those seem to be working well:
      • renaming table: "Event Log" -> "event"
      • EvWhen -> WhenStarted, WhenFinished
      • AppUser -> WhoAdmin, SysUser -> WhoSystem, Machine -> WhoNetwork

SQL

CREATE TABLE `event` (
    ID INT NOT NULL AUTO_INCREMENT COMMENT "used to track incomplete events; may be renumbered later",
    WhenStarted  DATETIME         NOT NULL COMMENT "set just before starting the event",
    WhenFinished DATETIME     DEFAULT NULL COMMENT "set after completing the event; indicates the code did not crash",
    ModType      VARCHAR(15)  DEFAULT NULL COMMENT "type of modification done by event",
    ModIndex     INT(4)       DEFAULT NULL COMMENT "ID of row being modified by this event",
    EvWhere      VARCHAR(255)     NOT NULL COMMENT "where in the code the event happened (suitable for filtering)",
    Params       VARCHAR(255) DEFAULT NULL COMMENT "any relevant parameters",
    Descr        VARCHAR(255) DEFAULT NULL COMMENT "description of event",
    Code         INT          DEFAULT NULL COMMENT "numeric event code unique to location (EvWhere)",
    WhoAdmin     VARCHAR(127) COMMENT "application username, for when we have a user-security system",
    WhoSystem    VARCHAR(127) COMMENT "who logged into the operating system (username)",
    WhoNetwork   VARCHAR(64)  COMMENT "network name of machine from which the event was initiated, if applicable",
    isError      BOOL         COMMENT "indicates whether event indicates a problem to fix",
    isSevere     BOOL         COMMENT "TRUE = important enough to send email to admin immediately",
    Notes        VARCHAR(255) DEFAULT NULL COMMENT "manually-entered notes",
    PRIMARY KEY (`ID`)
 ) ENGINE = MYISAM;