Ferreteria/v0.42/sql/node: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
(Created page with "==About== * '''table purpose''': root for all data * '''record purpose''': a thing that has values * '''Module''': {{l/version|odata}} ==History== * '''2017-03-12''' started *...")
 
m (6 revisions imported: moving this project here)
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''versions''': {{l/ferreteria/|v0.41/sql/node|0.41}}, {{l/ferreteria/|v0.42/sql/node|0.42}}, {{l/ferreteria/|v0.5/sql/node|0.5}}
==About==
==About==
* '''table purpose''': root for all data
* '''table purpose''': root for all data
* '''record purpose''': a thing that has values
* '''record purpose''': a thing that has values
* '''Module''': {{l/version|odata}}
* '''Module''': {{l/version|odata}}
==Concept==
Every '''node'''
* is a record in the node table
* can have zero or more '''leaf'''s
** There's generally no point to having zero, but no reason to forbid it.
* can have a (node) '''type''' which points to a handler-class
** so that when we're looking at a group of unspecified nodes, we know how to handle each one
==History==
==History==
* '''2017-03-12''' started
* '''2017-03-12''' started
Line 9: Line 17:
* '''2020-01-16''' redesigning for v0.4 (copied from [[Ferreteria/sql/tf node]])
* '''2020-01-16''' redesigning for v0.4 (copied from [[Ferreteria/sql/tf node]])
* '''2020-01-23''' copying from v0.41 to v0.42 essentially unaltered
* '''2020-01-23''' copying from v0.41 to v0.42 essentially unaltered
* '''2020-05-26''' decided to remove NOT NULL from Type user can create new Nodes without any input.
** Strongly inclined to make Type a pseudofield (Leaf), in any case.
* '''2021-01-19'''
** "integer width is deprecated"; also decided it should be 8 bytes
** added ID_Mom because it seems necessary to be able to support sub-nodes
==Fields==
==Fields==
* '''Type''': name of node type; code should know how to map these to node-handler classes
* '''Type''': name of node type; code should know how to map these to node-handler classes
==SQL==
==SQL==
<source lang=mysql>CREATE TABLE `node` (
<syntaxhighlight lang=mysql>CREATE TABLE `node` (
   `ID`      INT(4)      NOT NULL AUTO_INCREMENT,
   `ID`      BIGINT          NOT NULL AUTO_INCREMENT,
   `Type`    VARCHAR(255) NOT NULL COMMENT "name of node type",
  `ID_Mom`  BIGINT      DEFAULT NULL COMMENT "ID of parent node, if any",
   `WhenMade` DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP,
   `Type`    VARCHAR(255) DEFAULT NULL COMMENT "name of node type",
   `WhenMade` DATETIME         NOT NULL DEFAULT CURRENT_TIMESTAMP,
   PRIMARY KEY(`ID`)
   PRIMARY KEY(`ID`)
) ENGINE=InnoDB;</source>
) ENGINE=InnoDB;</syntaxhighlight>

Latest revision as of 16:44, 22 May 2022

versions: 0.41, 0.42, 0.5

About

  • table purpose: root for all data
  • record purpose: a thing that has values
  • Module: Template:L/version

Concept

Every node

  • is a record in the node table
  • can have zero or more leafs
    • There's generally no point to having zero, but no reason to forbid it.
  • can have a (node) type which points to a handler-class
    • so that when we're looking at a group of unspecified nodes, we know how to handle each one

History

  • 2017-03-12 started
  • 2017-04-09 decided there really should be a WhenMade timestamp; can always remove later
  • 2017-08-05 renamed Class to Type for consistency with tf_leaf: records use "types", code maps these to "classes"
  • 2020-01-16 redesigning for v0.4 (copied from Ferreteria/sql/tf node)
  • 2020-01-23 copying from v0.41 to v0.42 essentially unaltered
  • 2020-05-26 decided to remove NOT NULL from Type user can create new Nodes without any input.
    • Strongly inclined to make Type a pseudofield (Leaf), in any case.
  • 2021-01-19
    • "integer width is deprecated"; also decided it should be 8 bytes
    • added ID_Mom because it seems necessary to be able to support sub-nodes

Fields

  • Type: name of node type; code should know how to map these to node-handler classes

SQL

CREATE TABLE `node` (
  `ID`       BIGINT           NOT NULL AUTO_INCREMENT,
  `ID_Mom`   BIGINT       DEFAULT NULL COMMENT "ID of parent node, if any",
  `Type`     VARCHAR(255) DEFAULT NULL COMMENT "name of node type",
  `WhenMade` DATETIME         NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY(`ID`)
) ENGINE=InnoDB;