Defect #7669

Plugin Database Index Corrupted?

Added by Terence Mill almost 10 years ago. Updated over 9 years ago.

Status:ClosedStart date:2011-02-21
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Plugin Request
Target version:-
Resolution:Invalid Affected version:1.1.1

Description

We have a pĆ¼roblem with migrating a plugin called "redmine-blocks".
We removed old folder in /redmine/vendor/plugins and created new one.
Then we called "rake db:migrate_plugins RAILS_ENV=production" in /redmine folder a no database migration took place.
We restarted apache and when clicking on project we get internal error and this log:

ctionView::TemplateError (Mysql::Error: Table 'redmine.overview_blocks' doesn't exist: SHOW FIELDS FROM `overview_blocks`) on line #88 of vendor/plugins/projects_tree_view/app/views/projects/show.rhtml:
85:         </p>
86:   </div>
87:   <% end %>
88:   <%= call_hook(:view_projects_show_left, :project => @project) %>
89: </div>
90: 
91: <div class="splitcontentright">

    lib/redmine/hook.rb:63:in `send'
    lib/redmine/hook.rb:63:in `call_hook'
    lib/redmine/hook.rb:63:in `each'
    lib/redmine/hook.rb:63:in `call_hook'
    lib/redmine/hook.rb:60:in `tap'
    lib/redmine/hook.rb:60:in `call_hook'
    lib/redmine/hook.rb:144:in `call_hook'
    vendor/plugins/projects_tree_view/app/views/projects/show.rhtml:88:in `_run_rhtml_vendor47plugins47projects_tree_view47app47views47projects47show46rhtml'
    app/controllers/projects_controller.rb:166:in `show'
    passenger (2.2.14) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
    passenger (2.2.14) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
    passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler'
    passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application'
    passenger (2.2.14) lib/phusion_passenger/utils.rb:252:in `safe_fork'
    passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:163:in `start'
    passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
    passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
    passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously

As we take a look into mysql database "redmine", there is no table created with that name "overview_blocks".
Then we took a look into the plugins folder vendor/plugins/redmine_blocks/db/migrate and into the file "001_create_tables.rb"

class CreateTables < ActiveRecord::Migration
  def self.up
    create_table :overview_blocks do |t|
      t.column :project_id, :integer, :null =>false
      t.column :name, :string, :unique=>true, :null => false
    end

    create_table :home_blocks do |t|
      t.column :name, :string, :unique=>true, :null => false
    end

    Project.find(:all).each do |prj|
      OverviewBlock.new do |ob|
        ob.project_id = prj.id
        ob.name = 'members'
        ob.save
      end

      OverviewBlock.new do |ob|
        ob.project_id = prj.id
        ob.name = 'news'
        ob.save
      end

      OverviewBlock.new do |ob|
        ob.project_id = prj.id
        ob.name = 'issues'
        ob.save
      end
    end

  end

  def self.down
    drop_table :overview_blocks
    drop_table :home_blocks
  end
end

This look all right, but why does redmine migrate:db does not create this needed tables?
Is thete any reference table we have to clean up manually or do we have to rake "uinstall" something?

Tx for help

History

#1 Updated by Jean-Baptiste Barth over 9 years ago

  • Category changed from Database to Plugin Request
  • Status changed from New to Closed
  • Priority changed from High to Normal
  • Resolution set to Invalid

You should definitely report it to the plugin owner. FYI, you should call rake db:migrate:all to migrate everything including plugin. Plugin uninstallation steps depends on each plugin, but rake db:migrate:plugin NAME=redmine_blah VERSION=0 should be ok for most cases.

Also available in: Atom PDF