generaldesoftware / RedMine-plantillas-plugin

This plugin allow you choose a wiki template when you add a new page.
23 stars 22 forks source link

Redmine 2.3.1-stable migration problem #23

Open gilbertf opened 11 years ago

gilbertf commented 11 years ago

Hi, when I run rake redmine:plugins:migrate RAILS_ENV=production on a fresh installation with this plugin added to the plugin folder, db/migrate/012_add_missing_column_to_wiki_templates.rb fails with the following message:

SQLite3::SQLException: duplicate column name: visible_children: ALTER TABLE "wiki_templates" ADD "visible_children" boolean DEFAULT 't'

huangxh16888 commented 11 years ago

I got the same problem:

== AddMissingColumnToWikiTemplates: migrating ================================ -- add_column(:wiki_templates, :visible_children, :boolean, {:default=>true}) rake aborted! An error has occurred, all later migrations canceled:

Mysql2::Error: Duplicate column name 'visible_children': ALTER TABLE wiki_templates ADD visible_children tinyint(1) DEFAULT 1

akiko-pusu commented 11 years ago

Hi, @huangxh16888, @gilbertf I saw the same situation on fresh install.

Please try to change db/migrate/005_add_missing_indexes_to_wiki_templates.rb like this:

class AddMissingIndexesToWikiTemplates < ActiveRecord::Migration
  def self.up
    add_index :wiki_templates, [:author_id], :name => :index_wiki_templates_on_author_id
    add_index :wiki_templates, [:project_id], :name => :index_wiki_templates_on_project_id
  end

  def self.down
    remove_index :wiki_templates, :name => :index_wiki_templates_on_author_id
    remove_index :wiki_templates, :name => :index_wiki_templates_on_project_id
  end
end
huangxh16888 commented 11 years ago

@akiko-pusu Thank you! It works correctly.