23

Redmine を 1.3.0 から 2.0.0 にアップグレードしようとしていますが、データベースの移行に問題があります。コマンドを実行すると:

rake db:migrate RAILS_ENV=production

次のようなエラーが表示されます

rake aborted!
uninitialized constant RAILS_ENV

私のエラーログは次のとおりです。

ActiveRecord::SubclassNotFound (The single-table inheritance mechanism failed to locate the subclass: 'GoogleAppsAuthSource'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite AuthSource.inheritance_column to use another column for that information.):
app/models/user.rb:139:in `try_to_login'
app/controllers/account_controller.rb:143:in `password_authentication'
app/controllers/account_controller.rb:138:in `authenticate_user'
app/controllers/account_controller.rb:30:in `login'

古い redmine で使用しているプラ​​グインのリストは次のとおりです。

  1. Google Apps プラグイン

  2. Redmine コード レビュー プラグイン

  3. Redmine Hudson プラグイン

4

2 に答える 2

74

他の誰かがここでつまずいた場合、問題を解決する方法は 2 つあります。

  1. type という名前の列は使用しないでください。
  2. 列名を無意味なものに手動で設定します。

    self.inheritance_column = :_type_disabled
    

    参照: http://apidock.com/rails/ActiveRecord/Base/inheritance_column/class

于 2012-10-15T20:45:18.577 に答える
21

単一テーブルの継承エラーはtype、データベースで指定された列が原因である可能性があります。

Rails が という列名に遭遇した場合、typeそれはサブクラスを持つモデルであると想定するため、タイプによって使用するモデルが識別されます。もともとレール用に構築されていないプラグインがtypeモデル内の列を使用しているため、Rails が失敗したと思います。

于 2012-07-13T12:49:37.847 に答える