【问题标题】:Redmine Not Recognizing Migration File to Change DBRedmine 无法识别迁移文件以更改数据库
【发布时间】:2014-07-16 20:09:58
【问题描述】:

基本上我正在尝试通过插件将新列添加到现有的 Redmine 数据库表中。

据我所知,通过插件迁移到数据库的主要命令是:

rake redmine:plugins:migrate

然而,当我运行该命令时,在我的本地计算机上它说它正在迁移我已安装的所有插件,但它没有更新数据库。我可以做任何检查以确保 redmine 识别要迁移到哪个数据库?

例如,在我的一个插件中,我只是想使用以下迁移文件将 :datetime 类型的新字段 :foo 添加到 users 表:

class AddColumnIssuePosition < ActiveRecord::Migration

    def self.up
        change_table :user do |t|
            t.column :foo, :datetime
        end
    end

    def self.down
        change_table :user do |t|
            t.remove :foo
        end
    end

end

我运行了 migration rake 命令,它说它已经迁移了插件,但是它没有提供关于在“users”表中添加新列“foo”的任何细节......

Migrating user_foo (User Foo Plugin)...

它只是喷出那条线并在那里结束。在 users 表上找不到任何更改。

请原谅我,因为我对 Rails 有点陌生。

【问题讨论】:

    标签: mysql ruby-on-rails ruby migration redmine


    【解决方案1】:

    将您的迁移更改为如下所示:

    class AddColumnIssuePosition < ActiveRecord::Migration
    
      def change
        add_column :users, :foo, :datetime
      end
    
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-26
      • 2021-12-14
      • 1970-01-01
      • 1970-01-01
      • 2018-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多