小编Rah*_*hul的帖子

Bundler 尝试更新 rails 但它的版本保持不变

我正在尝试将 rails 5.0.7 更新到 5.2,但它表明

Bundler attempted to update rails but its version stayed the same
Run Code Online (Sandbox Code Playgroud)

我尝试更新的命令是:-

rails app:update
Run Code Online (Sandbox Code Playgroud)

但即使我尝试运行以下代码,它也没有更新导轨

bundle update rails
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

7
推荐指数
1
解决办法
1万
查看次数

索引名称“index_name”太长;限制为 63 个字符

当我运行 Rails 迁移命令时。我发现索引名称太长。我的迁移文件

class AddMissingIndices < ActiveRecord::Migration
  def change
    # We'll explicitly specify its name, as the auto-generated name is too long and exceeds 63
    # characters limitation.
    add_index :mailboxer_conversation_opt_outs, [:unsubscriber_id, :unsubscriber_type],
      name: 'index_mailboxer_conversation_opt_outs_on_unsubscriber_id_type'
    add_index :mailboxer_conversation_opt_outs, :conversation_id

    add_index :mailboxer_notifications, :type
    add_index :mailboxer_notifications, [:sender_id, :sender_type]

    # We'll explicitly specify its name, as the auto-generated name is too long and exceeds 63
    # characters limitation.
    add_index :mailboxer_notifications, [:notified_object_id, :notified_object_type],
      name: 'index_mailboxer_notifications_on_notified_object_id_and_type'

    add_index :mailboxer_receipts, [:receiver_id, :receiver_type]
  end
end
Run Code Online (Sandbox Code Playgroud)

服务器日志是

铁轨已中止!

StandardError:发生错误,此迁移和所有后续迁移均已取消:

表“mailboxer_conversation_opt_outs”上的索引名称“index_mailboxer_conversation_opt_outs_on_unsubscriber_type_and_unsubscriber_id”太长;限制为 63 …

migration postgresql indexing ruby-on-rails ruby-on-rails-4

1
推荐指数
1
解决办法
6094
查看次数