Project

General

Profile

Actions

Defect #14335

closed

Issue.rebuild! "lft" and "rgt" are 1 and 2

Added by Morten MacFly almost 11 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Wont fix
Affected version:

Description

Discussion here: http://www.redmine.org/boards/2/topics/38378

I would like to see this feature, because otherwise the update from an earlier version of Redmine might be broken.


Related issues

Related to Redmine - Defect #6579: Tree hierachy being currupted on multiple submissions of an issueClosedJean-Philippe Lang2010-10-05

Actions
Actions #1

Updated by Etienne Massip almost 11 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

If I understand well what you need is to run

ruby script/rails runner 'Project.rebuild_tree!' RAILS_ENV=production

Please reopen if I'm mistaken.

Actions #2

Updated by Morten MacFly almost 11 years ago

  • Status changed from Closed to Reopened

The suggested solution works indeed for the projects database. However, the same applies to the "issues" database which has these "lft" and "rgt" fields broken, too. So I re-opened the ticket (if you don't mind).

If you have a similar fix for that able that would be PERFECT!

Actions #3

Updated by Etienne Massip almost 11 years ago

Try:

Issue.rebuild!
Actions #4

Updated by Morten MacFly almost 11 years ago

No, in this case it did not work. All Issues remain allocated with "1" for "lft" and "2" for "rgt".

BTW: I noticed a very bad side-effect. If I remove a project (not archive, but delete) a lot of issues not related to this project get lost. too. Luckily I had a backup, but this might be related to the wrong binary search tree... maybe?!

Actions #5

Updated by Toshi MARUYAMA over 9 years ago

  • Status changed from Reopened to New
  • Resolution deleted (Invalid)

Morten MacFly wrote:

No, in this case it did not work. All Issues remain allocated with "1" for "lft" and "2" for "rgt".

It is awesome_nested_set bug.

Actions #6

Updated by Toshi MARUYAMA over 9 years ago

  • Related to Defect #6579: Tree hierachy being currupted on multiple submissions of an issue added
Actions #7

Updated by Toshi MARUYAMA over 9 years ago

  • Subject changed from Re-generate Binary trteree (lft and rgt) fields to Re-generate Issue Binary trteree (lft and rgt) fields
Actions #8

Updated by Toshi MARUYAMA over 9 years ago

  • Tracker changed from Feature to Defect
  • Subject changed from Re-generate Issue Binary trteree (lft and rgt) fields to Issue.rebuild! set "lft" and "rgt" are 1 and 2
Actions #9

Updated by Toshi MARUYAMA about 9 years ago

  • Subject changed from Issue.rebuild! set "lft" and "rgt" are 1 and 2 to Issue.rebuild! "lft" and "rgt" are 1 and 2
Actions #10

Updated by Toshi MARUYAMA about 9 years ago

  • Status changed from New to Closed
  • Resolution set to Wont fix

We dropped awesome_nested_set gem (#18860) in Redmine 3.0.0.

I have reported this issue.
https://github.com/collectiveidea/awesome_nested_set/issues/299

#6579#note-40

It seems okay to have 1 and 2 if the issue has no hierarchy, what do you expect ?

awesome_nested_set gem rebuild! should be as following.

$ echo 'select lft, rgt from issues;' | sqlite3 db/test.sqlite3
1|2
3|4
5|6
7|8
9|10
11|12
13|14
15|16
17|18
19|20
21|22
23|24
25|26
27|28

"lft" of new created issue with awesome_nested_set 2.1.6 is "Issue.maximum(:rgt) + 1"
source:trunk/test/test_helper.rb@13839#L217

And :scope definition has terrible "moving" bug and Redmine 2.6 workarounds it.
source:tags/2.6.1/app/models/issue.rb#L1331

Redmine 3.0 rebuild_tree! "lft" and "rgt" are 1 and 2.
source:trunk/lib/redmine/nested_set/issue_nested_set.rb@14031#L178
But it has no problem.
Because "lft" of new created issue on Redmine 3.0 is "1".
source:trunk/test/test_helper.rb@13841#L217
And Redmine 3.0 does not have terrible "moving" bug.

Actions

Also available in: Atom PDF