InstaGov/schema/edit log

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search

About

  • Purpose: Maintains an edit history of changes to everything except ratings, i.e. things which shouldn't be edited very much to begin with.
  • Note: Ideally, the size of this table could (and perhaps should) be kept to a minimum by recording only changes to existing records, not their initial creation -- but for prototyping purposes, this is proving to be impractical as the existing framework doesn't make it easy to detect which events represent new records and which are updates to existing records. On the other hand, there may be advantages to having these two types of events listed in the same log.

Fields

  • ModType: action key of the table whose modification is being recorded.
  • ModIndex: value of primary key (typically "ID") for record being modified

History

  • 2013-01-03
    • added "WhenStarted", "WhenFinished", "ID_User"
    • "Table"->"ModType" and "ID_Rec"->"ModIndex" for convention-compatibility with clsLogger_DataSet (events.php; see VbzCart/tables/event_log for existing table), although I'm writing a new class to handle logging to this table
    • "Field", "ValOld", and "ValNew" moved to edit_log_field

SQL

<mysql>CREATE TABLE `edit_log` (

  `ID`           INT          NOT NULL AUTO_INCREMENT,
  `ModType`      VARCHAR(15)  NOT NULL COMMENT "action key of table being modified",
  `ModIndex`     INT          NOT NULL COMMENT "primary key value of record being modified",
  `WhenStarted`  DATETIME     NOT NULL COMMENT "when the save was attempted",
  `WhenFinished` DATETIME DEFAULT NULL COMMENT "when the save was successfully completed",
  `ID_User`      INT          NOT NULL COMMENT "numerical ID of user who made the edit",
  PRIMARY KEY(`ID`)
)
ENGINE = MYISAM;</mysql>