I did a short description for issue 4004 (http://mantis.testlink.org/view.php?id=4004), regarding Testlink database documentation. This is a short text that explains about the node tree. As I am still not totally familiarized with the database there may have inconsistencies or errors in my text, that's why I'm sending it here to the dev-list for review.
Node tree
=========
In TestLink database we have an entity called node. A node can represent a:
- Test project
- Test plan
- Test suite
- Test case
- Test case version
- Test case step
- Requirement specification
- Requirement
- Requirement version
- Requirement revision
The table for the nodes entity is `nodes_hierarchy`.
mysql> describe nodes_hierarchy;
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(100) | YES | | NULL | |
| parent_id | int(10) unsigned | YES | MUL | NULL | |
| node_type_id | int(10) unsigned | NO | | 1 | |
| node_order | int(10) unsigned | YES | | NULL | |
+--------------+------------------+------+-----+---------+----------------+
The node id is its primary key.
The name is used as a description for the node. If the node is a test project then this field contains the test project name.
The parent_id contains a reference for a parent node's id. This way we can build a hierarchy of nodes (node tree), with a parent node and its children nodes.
The node_type_id is the foreign key for the table `node_types`, that represent the node type entity. This entity tells us, as the name says, what is the type of the node.
And lastly, the node_order field. It is used in conjunction with the parent_id field to define the order of the node in the node tree. Say we have a test suite node with three test case nodes. Each test case will have as parent_id the id of the test suite and the node_order defines the order that the test case appears under the test suite in the tree.
Here is the description of the node_types table.
mysql> describe node_types;
+-------------+------------------+------+-----+-------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+-------------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| description | varchar(100) | NO | | testproject | |
+-------------+------------------+------+-----+-------------+----------------+
=======
English is not my native English, so there may have spelling or grammar errors too.
Regards, Bruno