Skip to content

Upgrade Hyrax 2.x to Hyrax 3.x

Thomas Scherz edited this page Sep 27, 2024 · 3 revisions

These instructions are based on release notes to hyrax 3.6.

  1. Update Gemfile to specify these gems:
gem ‘bundler' 
gem 'active-fedora’
gem 'hyrax', '3.0.0'
gem 'dry-monads', '1.4.0' 
gem 'puma', '~> 5.6'
gem 'psych', '< 4’
gem “okcomputer”
# Needed for solr_wrapper to run x86_darwin architecture
gem 'http', '5.1.0'
gem 'llhttp-ffi', '0.4.0' # 0.5.0 is broken for x86_darwin architecture
run bundle update
  1. Run Rails DB Migrations:
rails hyrax:install:migrations
If you have any Solrizer calls in your overwrites or test you will need to replace them with
ActiveFedora::Indexing
ActiveFedora.index_field_mapper
  1. Universal Viewer switching to YARN
yarn install or rake assets:precompile
  1. If you use RIIIF you will need to adjust initializer
config/initializers/hyrax.rb
config.iiif_image_url_builder = lambda do |file_id, base_url, size, format|
  1. TinyMCE Config File
Remove link from the call.
  1. Using Diff Checkers and the Hyku left_v_right script : https://raw.githubusercontent.com/scientist-softserv/hyku-tools/main/bin/left_v_right. You can identify which files are only in the application, which files are only in the engine, and which files are in both. https://github.com/scientist-softserv/hyku-tools#reviewing-repositories

  2. View Overwrites In many of our institutions we have view overwrites that make calls to methods that are no longer there.

def create_work_presenter
    Deprecation.warn(self, "The `create_work_presenter` helper is deprecated " \
                           "for removal in Hyrax 3.0. The work selector has " \
                           "been removed the masthead in Hyrax 2.1.")

    Hyrax::SelectTypeListPresenter.new(current_user)
  end

in our toolbar view we pointed to the Hyrax Name Space instead of the ruby method.

i.e.
<% if Hyrax::SelectTypeListPresenter.new(current_user).many? %> INSTEAD OF
<% if create_work_presenter.many? %>
  1. Metadat Views for Multi_Value : The form views and edit_record fields need to be refactored to account for the new multi_value syntax. Multi-value should be moved into input_html.

app/views/records/edit_fields/_abstract.html.erb app/views/records/edit_fields/_right_notes.html.erb app/views/hyrax/base/_form.html.erb

<%= f.input key, input_html: { class: 'form-control', autocomplete: 'on', multiple: true }, required: f.object.required?(key) %> 

INSTEAD OF

<%= f.input key, as: :multi_value, input_html: { class: 'form-control', autocomplete: 'on' }, required: f.object.required?(key) %> 

  1. Metadata Overwrites If you overwrite this file : app/models/concerns/hyrax/basic_metadata.rb you will need to add in these new Basic Fields and remove them from your forms like they do at UofM : https://github.com/mlibrary/heliotrope/commit/27a5510254218ed058379ab505bfb4a4a18d4dc8

    1. Rights_Notes
    2. Abstract
    3. Alternative_Title
    4. Multiple v Singular
  2. Database Sipity

SQLite3::ConstraintException: UNIQUE constraint failed: sipity_entities.proxy_for_global_id: INSERT INTO "sipity_entities" ("proxy_for_global_id", "workflow_id", "created_at", "updated_at") VALUES (?, ?, ?, ?)

Solution : Make sure that you are using the current middleware configuration file. Our institution was doing a full overwrite of the app/services/hyrax/default_middleware_stack.rb. This file changed from 2.9.6 to 3.6.

  1. Universal Viewer Yarn Install

Share upgrade experience

Report on steps you took in addition to the above instructions

Clone this wiki locally