Ruby on rails PG::不可定义:错误:关系;活动的“存储块”;不存在

Ruby on rails PG::不可定义:错误:关系;活动的“存储块”;不存在,ruby-on-rails,postgresql,migration,ruby-on-rails-6,Ruby On Rails,Postgresql,Migration,Ruby On Rails 6,更新了应用程序Rails 5.2至6,更新添加了以下两个迁移: # This migration comes from active_storage (originally 20190112182829) class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] def up unless column_exists?(:active_storage_blobs, :servi

更新了应用程序Rails 5.2至6,更新添加了以下两个迁移:

    # This migration comes from active_storage (originally 20190112182829)
    class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
  def up
    unless column_exists?(:active_storage_blobs, :service_name)
      add_column :active_storage_blobs, :service_name, :string

      if configured_service = ActiveStorage::Blob.service.name
        ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
      end

      change_column :active_storage_blobs, :service_name, :string, null: false
    end
  end
end
——此迁移来自活动存储(最初为201901121829)
类AddServiceNameToActiveStorageBlobs

#此迁移来自活动存储(最初为20191206030411)
类CreateActiveStorageVariantRecords

尝试运行迁移会在标题上出现me错误。没有在网上找到任何东西,关于如何修复它有什么想法吗?

活动存储\u blobs
表还不存在。您需要首先运行:

rails active_storage:install
此命令将为两个表添加两次迁移:
active\u storage\u attachments
active\u storage\u blob

在进行上述迁移之前,需要先运行这些新迁移。有一个诀窍,你可以考虑手动改变你上面2个迁移的文件名中的时间戳,比2个新迁移中的一个要高:<代码> Actuvia存储:安装< /Calp>将创建.< /P>
一旦所有这些都排序完毕,运行rake db:migrate

,非常感谢。我曾经在一位同事的帮助下独自做过一次,忘记了这一步。读了你的答案xD后,我的反应是facepalm
rails active_storage:install