InstaGov/schema/rating 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: Records every time a user submits or revises a rating.

History

  • 2013-01-06
    • Removed "ID_Solution" field on the assumption that it was an earlier version of "ID_Answer" and should have been removed when that field was added.
    • Removed "ID_Proxy" because the schemata for proxying haven't been devised yet, so there's no way to know what would be an appropriate way to record their usage.
  • 2013-01-10
    • Removed ID_User because it's redundant. If we need to record anything about the user, it would be IP address or browser, but that should be left up to a session manager (and it's not clear that this much tracking of the user's access habits would be consistent with the design goals).
    • Made timestamp fields consistent with other event logs -- it might be important to record that someone tried to update their rating but it didn't go through. (...not that I can think of any circumstances, other than outright bugs affecting a large number of users, where the logging would succeed but the rating update would fail.)
    • Removed ID_Answer because it's redundant too; look up the Rating (from ID_Rating) and get the Answer from that.

SQL

<mysql>CREATE TABLE `rating_log` (

  `ID`           INT          NOT NULL AUTO_INCREMENT,
  `ID_Rating`    INT          NOT NULL COMMENT "rating.ID to which this rating was applied",
  `Value`        INT          NOT NULL COMMENT "rating value",
  `WhenStarted`  DATETIME     NOT NULL COMMENT "when this update attempt was received",
  `WhenFinished` DATETIME DEFAULT NULL COMMENT "when this update attempt was successful",
  `Remark`       VARCHAR(255)          COMMENT "voter's comments on this rating (can include link or redirect)",
  PRIMARY KEY(`ID`)
)
ENGINE = MYISAM;</mysql>