Ferreteria/sql/event: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
(tweaks)
m (8 revisions imported: moving this project here)
 
(6 intermediate revisions by one other user not shown)
Line 2: Line 2:
* '''Purpose''': base table for logging application events
* '''Purpose''': base table for logging application events
** Records only the basic information common to all (or nearly all) events.
** Records only the basic information common to all (or nearly all) events.
* '''Future''':
** Eventually we will probably want to archive session records, so there should be an archive version of this table which directly stores <s>at least the User ID and</s> maybe [[IP address]] and browser. Events whose sessions are being archived would be migrated to that table as part of the same process.
** Maybe we will also want the data in <code>TypeCode</code> and <code>Stash</code> to be compressed.
** The old event logger had a flag to indicate that an email should be sent, so some equivalent functionality is needed -- but probably what would be better is to have a list of event-types for which emails should be sent, so it's not hard-coded. (This could also allow for different forms of notification.)
==History==
==History==
* '''2017-05-06''' Adapting the good bits from [[VbzCart/tables/event log]]
* '''2017-02-06''' Adapting the good bits from [[VbzCart/tables/event log]]
* '''2017-02-10''' Belatedly figured out that Session records don't maintain User ID indefinitely, so we need to record that here.
** Also expanding <code>TypeCode</code> from 7 chars to 255, so we can have prefixes to avoid event-name conflicts.
==SQL==
==SQL==
<mysql>CREATE TABLE `event` (
<source lang=mysql>CREATE TABLE `event` (
     ID        INT              NOT NULL AUTO_INCREMENT COMMENT "log line identifier",
     ID        INT              NOT NULL AUTO_INCREMENT COMMENT "log line identifier",
     WhenStart  DATETIME     DEFAULT NULL COMMENT "set just before starting the event",
     WhenStart  DATETIME         NOT NULL COMMENT "set just before starting the event",
     ID_Session INT             NOT NULL COMMENT "session.ID of active session",
     ID_Session INT         DEFAULT NULL COMMENT "session.ID of active session",
    ID_Acct    INT          DEFAULT NULL COMMENT "user_acct.ID of active user account, if any",
    TypeCode  VARCHAR(255) DEFAULT NULL COMMENT "mnemonic event code",
     Descrip    TEXT        DEFAULT NULL COMMENT "code-generated description of event",
     Descrip    TEXT        DEFAULT NULL COMMENT "code-generated description of event",
     Stash      BLOB         DEFAULT NULL COMMENT "additional event-related data that doesn't need to be searchable",
     Stash      TEXT         DEFAULT NULL COMMENT "additional event-related data that doesn't need to be searchable",
     PRIMARY KEY (`ID`)
     PRIMARY KEY (`ID`)
  ) ENGINE = InnoDB;</mysql>
  ) ENGINE = InnoDB;</source>

Latest revision as of 16:42, 22 May 2022

About

  • Purpose: base table for logging application events
    • Records only the basic information common to all (or nearly all) events.
  • Future:
    • Eventually we will probably want to archive session records, so there should be an archive version of this table which directly stores at least the User ID and maybe IP address and browser. Events whose sessions are being archived would be migrated to that table as part of the same process.
    • Maybe we will also want the data in TypeCode and Stash to be compressed.
    • The old event logger had a flag to indicate that an email should be sent, so some equivalent functionality is needed -- but probably what would be better is to have a list of event-types for which emails should be sent, so it's not hard-coded. (This could also allow for different forms of notification.)

History

  • 2017-02-06 Adapting the good bits from VbzCart/tables/event log
  • 2017-02-10 Belatedly figured out that Session records don't maintain User ID indefinitely, so we need to record that here.
    • Also expanding TypeCode from 7 chars to 255, so we can have prefixes to avoid event-name conflicts.

SQL

CREATE TABLE `event` (
    ID         INT              NOT NULL AUTO_INCREMENT COMMENT "log line identifier",
    WhenStart  DATETIME         NOT NULL COMMENT "set just before starting the event",
    ID_Session INT          DEFAULT NULL COMMENT "session.ID of active session",
    ID_Acct    INT          DEFAULT NULL COMMENT "user_acct.ID of active user account, if any",
    TypeCode   VARCHAR(255) DEFAULT NULL COMMENT "mnemonic event code",
    Descrip    TEXT         DEFAULT NULL COMMENT "code-generated description of event",
    Stash      TEXT         DEFAULT NULL COMMENT "additional event-related data that doesn't need to be searchable",
    PRIMARY KEY (`ID`)
 ) ENGINE = InnoDB;