Ferreteria/v0.42/log: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
(copied from 0.41, leaving out tables no longer used)
 
(updated to 0.42 design (mainly log_leaf))
Line 7: Line 7:
<source lang=mysql>CREATE TABLE `log` (
<source lang=mysql>CREATE TABLE `log` (
   `ID`      INT(4)      NOT NULL AUTO_INCREMENT,
   `ID`      INT(4)      NOT NULL AUTO_INCREMENT,
   `Type`    VARCHAR(255) NOT NULL COMMENT "name of node type",
   `Type`    VARCHAR(255) NOT NULL COMMENT "name of event type",
   `WhenMade` DATETIME    NOT NULL DEFAULT CURRENT_TIMESTAMP,
   `WhenMade` DATETIME    NOT NULL DEFAULT CURRENT_TIMESTAMP,
   PRIMARY KEY(`ID`)
   PRIMARY KEY(`ID`)
Line 15: Line 15:
<source lang=mysql>CREATE TABLE `log_leaf` (
<source lang=mysql>CREATE TABLE `log_leaf` (
   `ID`      INT(4)        NOT NULL AUTO_INCREMENT,
   `ID`      INT(4)        NOT NULL AUTO_INCREMENT,
   `ID_Node` INT(4)        NOT NULL COMMENT "ID of log node to which this value belongs",
   `ID_Node` INT(4)        NOT NULL COMMENT "ID of event to which this value belongs",
   `Name`    VARCHAR(255)  NOT NULL COMMENT "internal name of this value",
   `Name`    VARCHAR(255)  NOT NULL COMMENT "field name of this value",
   `Type`   VARCHAR(255) NOT NULL COMMENT "name of leaf (field) type",
   `Value`   LONGTEXT DEFAULT NULL COMMENT "value, in string format",
   PRIMARY KEY(`ID`),
   PRIMARY KEY(`ID`),
   UNIQUE KEY(`ID_Node`,`Name`)
   UNIQUE KEY(`ID_Node`,`Name`)
) ENGINE=InnoDB;</source>
) ENGINE=InnoDB;</source>

Revision as of 15:08, 25 January 2020

The event-logging system uses the object-data system, including the table structure (under different names). Schema documentation here will be kept separate in case of tweaks, and to make it easier to construct the tables.

Tentatively, the "log.Type" field will be slightly repurposed from its usage in node.

Tables

log

Documentation: Template:L/version

CREATE TABLE `log` (
  `ID`       INT(4)       NOT NULL AUTO_INCREMENT,
  `Type`     VARCHAR(255) NOT NULL COMMENT "name of event type",
  `WhenMade` DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY(`ID`)
) ENGINE=InnoDB;

log_leaf

Documentation: Template:L/version

CREATE TABLE `log_leaf` (
  `ID`      INT(4)        NOT NULL AUTO_INCREMENT,
  `ID_Node` INT(4)        NOT NULL COMMENT "ID of event to which this value belongs",
  `Name`    VARCHAR(255)  NOT NULL COMMENT "field name of this value",
  `Value`   LONGTEXT  DEFAULT NULL COMMENT "value, in string format",
  PRIMARY KEY(`ID`),
  UNIQUE KEY(`ID_Node`,`Name`)
) ENGINE=InnoDB;