Project columns 'lft' and 'rgt' empty after migration 104

Added by Andreas Hartmann almost 11 years ago

Hi everybody,

I just upgraded my Redmine installation. Migration 104 (104_add_projects_lft_and_rgt.rb) created new project columns 'lft' and 'rgt', but since they are empty, various exceptions are thrown when I try to access the Redmine application.

Do I have to insert values into these columns manually? What do they mean?

Thanks a lot for any hints!

-- Andreas

Replies (13)

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Andreas Hartmann almost 11 years ago

I assume the values should have been set in migration 105, but apparently this has not happened. Here's the output of the migration:

105 BuildProjectsTree: migrating =========================================
105 BuildProjectsTree: migrated (0.2385s) ================================

None of the column values for 'lrt' and 'rgt' of my projects table has been set.

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Andreas Hartmann almost 11 years ago

Apparently migration 105 failed, probably because a PATH problem in my setup. I invoked Projects.rebuild! from the Ruby CLI, it worked and inserted the missing values.

Sorry for the noise.

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Andreas Hartmann almost 11 years ago

I just replayed the migration back and forth, but Projects.rebuild! just isn't executed – it works only from the CLI. Could there be anything wrong with my setup?

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Geordee Naliyath almost 11 years ago

I too have this problem. The projects is broken because of this. By the way how do you invoke Projects.rebuild! from Ruby CLI?

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Andreas Hartmann almost 11 years ago

By the way how do you invoke Projects.rebuild! from Ruby CLI?

I just start the CLI for the production environment and type "Projects.rebuild!" (autocomplete finds it). Then the missing entries are added to the DB.

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Geordee Naliyath almost 11 years ago

Thanks! Its working now. I confirm that there is some problem with 105.

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Robert Sköld over 10 years ago

Hey, i seem to have the same issue with the lft/rgt not being populated, but when i tried the Project.rebuild! command in the CLI i instead got this message:

ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: parent.rgt: SELECT count(*) AS count_all FROM "projects" LEFT OUTER JOIN "projects" AS parent ON "projects"."parent_id" = parent.id WHERE ("projects"."lft" IS NULL OR "projects"."rgt" IS NULL OR "projects"."lft" >= "projects"."rgt" OR ("projects"."parent_id" IS NOT NULL AND ("projects"."lft" <= parent."lft" OR "projects"."rgt" >= parent."rgt")))

Not sure what to do to fix this though.

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Alejandro Celery over 10 years ago

I have the exact same error.
Have you had any luck fixing it?

Regards,
Alex

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Andreas Hartmann over 10 years ago

Have you had any luck fixing it?

No, sorry. But invoking Projects.rebuild! from the CLI seems to be a decent workaround (at least for me), up to now I didn't face any problems.

-- Andreas

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Alejandro Celery over 10 years ago

I can´t find Projects.rebuild!.
The CLI in this case means the bash console, the irb interpreter, something else?
And how exactly do you do the invocation?

On another note, I installed rails-2.2.2 from source and added symlinks in .../vendor/rails to /usr/lib/ruby/gems/1.8/gems/...
Is this the right procedure?

Thanks!

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Alejandro Celery over 10 years ago

Oh, and by the way, that installation didn´t have an ActiveModel folder to link to, maybe that was the problem.
Can anyone shed some light on this?
Thanks!

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Artur Cichosz over 9 years ago

I have the same problem as Alejandro. I have no Idea how to launch this command "Projects:rebuild!". I tried to do this using the redmine console (ruby script/console production) but I got the following error after I had typed "Projects:rebuild!" from this running console.

Loading production environment (Rails 2.3.5)
>> Projects:rebuild!
NoMethodError: undefined method `Projects' for #<Object:0xb756194c>
        from (irb):1

What are you guys talking about speeking of "CLI"? I have a problem with the project overview in redmine. The nesting hierarchy of projects and subprojects just sucks although the parent-relations in the table "projects" are correct.
I suspect it can have something to do with those fields 'lft' and 'rgt'. What are those fields responsible for? Looks like some kind of pointers to me.
Did anybody else face this nesting problem to?

Thanks!

RE: Project columns 'lft' and 'rgt' empty after migration 104 - Added by Artur Cichosz over 9 years ago

Projects.rebuild! of course but still problems

Loading production environment (Rails 2.3.5)
>> Projects.rebuild!
NameError: uninitialized constant Projects
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
        from (irb):1

The question remains the same. Can those fields 'lft' and 'rgt' be responsible for the wrong nesting displaing the project overview?

(1-13/13)