FinanceFerret/2.0/sql/event: Difference between revisions

From Woozle Writes Code
< FinanceFerret‎ | 2.0‎ | sql
Jump to navigation Jump to search
(extracted from main page)
 
(updates from experience with VbzCart)
Line 2: Line 2:
* '''Version''': Copied, with only slight changes, from [[VbzCart tables]]. 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.
* '''Version''': Copied, with only slight changes, from [[VbzCart tables]]. 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)
** 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'''
* '''Notes'''
** Have to use "Ev" prefix for field names because When and Where are keywords.
** Have to use "Ev" prefix for field names that would otherwise be keywords: <s>When</s>, 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==
==SQL==
<section begin=sql /><mysql>DROP TABLE IF EXISTS `Event Log`;
<section begin=sql /><mysql>CREATE TABLE `event` (
CREATE TABLE `Event Log` (
     ID INT NOT NULL AUTO_INCREMENT COMMENT "used to track incomplete events; may be renumbered later",
     ID INT NOT NULL AUTO_INCREMENT COMMENT "log line identifier",
     WhenStarted  DATETIME         NOT NULL COMMENT "set just before starting the event",
     EvWhen DATETIME NOT NULL COMMENT "when the event started",
    WhenFinished DATETIME    DEFAULT NULL COMMENT "set after completing the event; indicates the code did not crash",
     EvWhere varchar(255) COMMENT "where in the code the event happened (suitable for filtering)",
    ModType      VARCHAR(15)  DEFAULT NULL COMMENT "type of modification done by event",
     Params varchar(255) COMMENT "any relevant parameters",
    ModIndex    INT(4)      DEFAULT NULL COMMENT "ID of row being modified by this event",
     Descr varchar(255) COMMENT "description of event",
     EvWhere     VARCHAR(255)     NOT NULL COMMENT "where in the code the event happened (suitable for filtering)",
     Code INT DEFAULT NULL COMMENT "numeric event code unique to location (EvWhere)",
     Params       VARCHAR(255) DEFAULT NULL COMMENT "any relevant parameters",
     AppUser varchar(127) COMMENT "application username, for when we have a user-security system",
     Descr       VARCHAR(255) DEFAULT NULL COMMENT "description of event",
     SysUser varchar(127) COMMENT "who logged into the operating system (username)",
     Code         INT         DEFAULT NULL COMMENT "numeric event code unique to location (EvWhere)",
     Machine varchar(64) COMMENT "network name of machine from which the event was initiated, if applicable",
     WhoAdmin    VARCHAR(127) COMMENT "application username, for when we have a user-security system",
     isError BOOL COMMENT "FALSE = this is just a message or normal event; TRUE = there is a problem to fix (error)",
     WhoSystem    VARCHAR(127) COMMENT "who logged into the operating system (username)",
     isSevere BOOL COMMENT "TRUE = important enough to send email to admin immediately",
     WhoNetwork  VARCHAR(64) COMMENT "network name of machine from which the event was initiated, if applicable",
     Notes varchar(255) DEFAULT NULL COMMENT "manually-entered notes",
     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`)
     PRIMARY KEY (`ID`)
  ) ENGINE = MYISAM;</mysql>
  ) ENGINE = MYISAM;</mysql>
<section end=sql />
<section end=sql />

Revision as of 19:29, 31 March 2010

About

  • Version: Copied, with only slight changes, from VbzCart tables. 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

<section begin=sql /><mysql>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;</mysql>

<section end=sql />