1 # The main variations tree lives in table tree_node, referencing the current
2 # version of the nodes in tree_node_archive. Each node has a set of SGF nodes
3 # (sgf_node), set of attributed comments (node_comment), editorial comment
4 # and possibly other metadata later.
9 DROP TABLE tree_node_archive;
12 CREATE TABLE tree_node_archive (
13 id INT AUTO_INCREMENT PRIMARY KEY,
15 # Non-authoritative commentary (e.g. short description of upcoming variations)
19 CREATE TABLE tree_node (
20 id INT AUTO_INCREMENT PRIMARY KEY,
21 parent INT DEFAULT NULL,
22 FOREIGN KEY (parent) REFERENCES tree_node (id) ON DELETE CASCADE,
25 FOREIGN KEY (version) REFERENCES tree_node_archive (id)
29 # Board-related SGF node
30 # This should be used only for trivial SGF nodes; any metadata should be
31 # stored in proper table columns.
32 CREATE TABLE sgf_node (
33 id INT AUTO_INCREMENT PRIMARY KEY,
36 FOREIGN KEY (tnode) REFERENCES tree_node_archive (id) ON DELETE CASCADE,
43 INSERT INTO tree_node_archive SET editorial="The Road Begins Here";
44 INSERT INTO tree_node SET version=1;