【问题标题】:Error when creating db with Blog engine使用博客引擎创建数据库时出错
【发布时间】:2011-05-16 14:22:14
【问题描述】:

我已经安装了一个RefineryCMS 应用程序,一切正常,直到我决定安装它的博客引擎。

我从头开始运行应用程序迁移(包括博客),我收到以下错误:

Mysql2::Error: Unknown column 'custom_title' in 'field list': INSERT INTO `pages`  (`browser_title`, `path`, `meta_description`, `created_at`, `link_url`, `custom_title_type`, `draft`, `title`, `skip_to_first_child`, `deletable`, `updated_at`, `position`, `rgt`, `custom_title`, `meta_keywords`, `parent_id`, `menu_match`, `lft`, `show_in_menu`, `depth`) VALUES (NULL, NULL, NULL, '2011-03-10 16:32:08', '/blog', 'none', 0, 'Blog', 0, 0, '2011-03-10 16:32:08', 2, 8, NULL, NULL, NULL, '^/blogs?(/|/.+?|)$', 7, 1, NULL)

我看到这是known issue,但我找不到适用于开发和生产环境的简洁解决方案。

顺便说一句,我使用rails g engine_name 命令安装的自定义引擎看到了这种情况。奇怪的是,如果您在之前的所有迁移都运行过之后运行这些迁移,则不会发生这种情况。它只是在从头开始运行所有应用程序迁移时发生。

有什么想法吗?

更新:

这是我的db/seeds/refinerycms_blog.rb 文件在我收到的评论之后的样子:

Page.reset_column_information

User.find(:all).each do |user|
  user.plugins.create(:name => "refinerycms_blog",
                      :position => (user.plugins.maximum(:position) || -1) +1)
end

page = Page.create(
  :title => "Blog",
  :link_url => "/blog",
  :deletable => false,
  :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
  :menu_match => "^/blogs?(\/|\/.+?|)$"
)

Page.default_parts.each do |default_page_part|
  page.parts.create(:title => default_page_part, :body => nil)
end

但它仍然无法正常工作。有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails-3 refinerycms


    【解决方案1】:

    将以下内容添加到它复制到 db/seeds/ 的博客种子文件的顶部:

    Page.reset_column_information
    

    【讨论】:

    • 这并不能解决问题。我将编辑帖子以便使用此代码对其进行更新。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-17
    • 2011-06-26
    • 2021-04-24
    • 2012-03-26
    • 1970-01-01
    • 2011-11-08
    • 1970-01-01
    相关资源
    最近更新 更多