New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection Extensions: Release Migration Notes #1596

Open
elrayle opened this Issue Aug 30, 2017 · 5 comments

Comments

Projects
2 participants
@elrayle
Contributor

elrayle commented Aug 30, 2017


Uber Tracking Issues | Plan: Merge into master 2.0 | Backwards Compatibility Analysis


Under Development

The major features of this release include:

  • Collection Extensions with collection types and control over collection nesting, sharing, discovery, branding, and membership in collections.
  • UniversalViewer for images in works
  • UI/UX improvements

Upgrade Notes

Migration Procedures from Hyrax 2.0.x to 2.1.0

The following steps describe the process for migrating to Hyrax 2.1.0 which includes the Collection Extensions work. The steps should be run in the order presented.

Update gem

Edit Gemfile or gemspec to update the version of hyrax.

gem 'hyrax', '2.1.0'

and run

bundle update hyrax

Database: Application DB changes are all covered by db:migrate

  • NEW: table to hold collection types
  • NEW: table to hold collection type participants
  • NEW: table to hold collection branding information (e.g. info about banner and logo images)
  • MODIFIED: table permissions_templates - rename admin_set_id to source_id

Run migrations to get database changes...

rails hyrax:install:migrations
rails db:migrate

You will also need to run migrate for tests to update your test database.

rails db:migrate RAILS_ENV=test

Default Collection Types

An existing app will have to run a generator to add the pre-defined collection types: user_collection and admin_set

rails hyrax:default_collection_types:create

NOTE: db:migrate must be run before running the generator for default collection types.

Collection Migration

Fedora/Solr Collection Model

CE adds one property to Collections model... collection_type_gid, which identifies the type (RDF::Vocab::SCHEMA.additionalType) of each collection. The gid is generated based on the collection type id (e.g. gid://internal/hyrax-collectiontype/:id).

Migration Process

The migration process performs two updates for every collection...

  • store the User Collection gid as the collection type for all legacy collections
  • add a Permission Template and set Accesses based on sharing information in the legacy collection

NOTE: Solr and Fedora services need to be running when this script is called.

rails hyrax:migrate:add_collection_type_and_permissions_to_collections

Instructions for setting up the UniversalViewer for images in works

UniversalViewer setup is in the Management Guide in section Image Server

Tinymce configuration changes

Some modifications were made to the tinymce editor configuration. If you are creating a new app, these configurations will be made for you as part of the hyrax installation process. If you are migrating an app, you will want to review your app's config/tinymce.yml file and compare it to the new one in Hyrax at hyrax/lib/generators/hyrax/templates/config/tinymce.yml.

Avoid flash messages being swallowed for XHR requests

Flash messages are being discarded by Blacklight for XHR requests. To avoid this, add the following line to your app at app/controllers/application_controller.rb.

skip_after_action :discard_flash_if_xhr

Avoid Performance Issues with solr-suggest

Recommended for all Hyrax apps.

It is strongly suggested that you turn off solr-suggest. Details on why and how to do this are in Fix performance issue caused by solr-suggest.

Troubleshooting Migration

Fellow Hyrax developers are gathering their experiences with Troubleshooting Migration from Hyrax 2.0.x to 2.1.0. You may want to visit this guide and contribute your experiences.

Changes

v2.0.1...v2.1.0.rc2

@mjgiarlo

This comment has been minimized.

Show comment
Hide comment
@mjgiarlo

mjgiarlo Nov 21, 2017

Member
$ rake --trace hyrax:default_collection_types:create
** Invoke hyrax:default_collection_types:create (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute hyrax:default_collection_types:create
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "hyrax_collection_types" does not exist
LINE 8:                WHERE a.attrelid = '"hyrax_collection_types"'...
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
                     c.collname, col_description(a.attrelid, a.attnum) AS comment
                FROM pg_attribute a
                LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                LEFT JOIN pg_type t ON a.atttypid = t.oid
                LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
               WHERE a.attrelid = '"hyrax_collection_types"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

db migration must be run before generator.

Member

mjgiarlo commented Nov 21, 2017

$ rake --trace hyrax:default_collection_types:create
** Invoke hyrax:default_collection_types:create (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute hyrax:default_collection_types:create
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "hyrax_collection_types" does not exist
LINE 8:                WHERE a.attrelid = '"hyrax_collection_types"'...
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
                     c.collname, col_description(a.attrelid, a.attnum) AS comment
                FROM pg_attribute a
                LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                LEFT JOIN pg_type t ON a.atttypid = t.oid
                LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
               WHERE a.attrelid = '"hyrax_collection_types"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

db migration must be run before generator.

@mjgiarlo

This comment has been minimized.

Show comment
Hide comment
@mjgiarlo

mjgiarlo Nov 21, 2017

Member

Generator doesn't seem to make any changes when run after db:migrate, and it outputs lines that are either contradictory or at least that don't make sense to me:

Default collection type is user_collection
Default collection type is admin_set
Member

mjgiarlo commented Nov 21, 2017

Generator doesn't seem to make any changes when run after db:migrate, and it outputs lines that are either contradictory or at least that don't make sense to me:

Default collection type is user_collection
Default collection type is admin_set
@mjgiarlo

This comment has been minimized.

Show comment
Hide comment
@mjgiarlo

mjgiarlo Nov 21, 2017

Member

@elrayle It appears that Collections and AdminSets must be reindexed, else the following code:

[20, 29] in /home/mjg/.rvm/gems/ruby-2.4.1@nurax/bundler/gems/hyrax-7c18c77c3c77/app/presenters/hyrax/collection_presenter.rb
   20: 
   21:     delegate(*Hyrax::CollectionType.collection_type_settings_methods, to: :collection_type, prefix: :collection_type_is)
   22: 
   23:     def collection_type
   24:       gid = Array.wrap(solr_document.fetch('collection_type_gid_ssim', [])).first
=> 25:       @collection_type ||= CollectionType.find_by_gid!(gid)
   26:     end

causes an error because gid winds up nil, because currently indexed solr documents have not been made aware of the new field.

Member

mjgiarlo commented Nov 21, 2017

@elrayle It appears that Collections and AdminSets must be reindexed, else the following code:

[20, 29] in /home/mjg/.rvm/gems/ruby-2.4.1@nurax/bundler/gems/hyrax-7c18c77c3c77/app/presenters/hyrax/collection_presenter.rb
   20: 
   21:     delegate(*Hyrax::CollectionType.collection_type_settings_methods, to: :collection_type, prefix: :collection_type_is)
   22: 
   23:     def collection_type
   24:       gid = Array.wrap(solr_document.fetch('collection_type_gid_ssim', [])).first
=> 25:       @collection_type ||= CollectionType.find_by_gid!(gid)
   26:     end

causes an error because gid winds up nil, because currently indexed solr documents have not been made aware of the new field.

@elrayle

This comment has been minimized.

Show comment
Hide comment
@elrayle

elrayle Nov 22, 2017

Contributor

There is a fix for line 24 in the PR #2251.

Contributor

elrayle commented Nov 22, 2017

There is a fix for line 24 in the PR #2251.

@elrayle

This comment has been minimized.

Show comment
Hide comment
@elrayle

elrayle Nov 22, 2017

Contributor

And yes, db:migrate has to be run before running the collection type generator.

Contributor

elrayle commented Nov 22, 2017

And yes, db:migrate has to be run before running the collection type generator.

@elrayle elrayle changed the title from Collection Extensions: Backward Compatibility Analysis to Collection Extensions: Release Migration Notes Jan 10, 2018

@conorom conorom referenced this issue Feb 21, 2018

Open

Upgrade to Hyrax 2.0.1 #1517

0 of 1 task complete

@jgondron jgondron referenced this issue Apr 9, 2018

Merged

Disable discard_flash_if_xhr behavior #2905

0 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment