Project

General

Profile

I have upgraded to 1.0.1 ,significance of lft and rgt

Added by mjnhbg w over 13 years ago

Hi ,

I have upgraded redmine 0.8.3 to 1.0.1. When i am going database changes made in 1.0.1 i found this lft and rgt fields which uses some nested set structure which i couldnt get it. I didnt find info in wiki also about this. So can anyone tell me the login behind it how is it value in issues and projects table?
What is difference between root_id and parent_id in issues?


Replies (3)

RE: I have upgraded to 1.0.1 ,significance of lft and rgt - Added by Felix Schäfer over 13 years ago

mjnhbg w wrote:

I have upgraded redmine 0.8.3 to 1.0.1. When i am going database changes made in 1.0.1 i found this lft and rgt fields which uses some nested set structure which i couldnt get it. I didnt find info in wiki also about this.

There's no info in the wiki because it is redmine internal stuff and you shouldn't dabble around that unless you know what you are doing, and that implies being somewhat familiar with the code, which is documentation enough :-)

So can anyone tell me the login behind it how is it value in issues and projects table?
What is difference between root_id and parent_id in issues?

The lft, rgt and root_id are the nested set attributes, the parent_id is IIRC just a helper to avoid having to traverse the set to find the parent issue. The parent_id will probably be removed in the future though.

RE: I have upgraded to 1.0.1 ,significance of lft and rgt - Added by Marco Gutsche over 13 years ago

mjnhbg w wrote:

What is difference between root_id and parent_id in issues?

root_id is the id from the highest top ticket, parent_id the id from the current parent.

For example:
ID 1
ID 2 (child of id 1)
ID 3( child of id 2)

ID 2 and 3 have both the root_id 1.
ID 2 has the parent_id 1
ID 3 has the parent_id 2

RE: I have upgraded to 1.0.1 ,significance of lft and rgt - Added by Steve Lefevre over 13 years ago

To understand the significance of lft and rgt, you'll want to understand a modified preorder tree traversal:

http://articles.sitepoint.com/article/hierarchical-data-database/2
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

But the others are right... don't go mucking around unless you are looking for breakage! :)

    (1-3/3)