Class: Hyrax::Collections::MigrationService Deprecated

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/collections/migration_service.rb

Overview

Deprecated.

this migration tool should no longer be useful after Hyrax 2.1.0; Removal is planned for 4.0

Responsible for migrating legacy collections. Legacy collections are those created before Hyrax 2.1.0 and are identified by the lack of the collection having a collection type gid.

Class Method Summary collapse

Class Method Details

.migrate_all_collectionsObject

Migrate all legacy collections to extended collections with collection type assigned. Legacy collections are those created before Hyrax 2.1.0 and are identified by the lack of the collection having a collection type gid.


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/hyrax/collections/migration_service.rb', line 13

def self.migrate_all_collections
  Deprecation.warn('This migration tool will be removed in Hyrax 4.0.0.')

  Rails.logger.info "*** Migrating #{::Collection.count} collections"
  ::Collection.all.each do |col|
    migrate_collection(col)
    Rails.logger.info "  migrating collection - id: #{col.id}, title: #{col.title}"
  end

  AdminSet.all.each do |adminset|
    migrate_adminset(adminset)
    Rails.logger.info "  migrating adminset - id: #{adminset.id}, title: #{adminset.title}"
  end
  Rails.logger.info "--- Migration Complete"
end

.repair_migrated_collectionsObject

Validate that migrated collections have both the collection type gid assigned and the permission template with access created and associated with the collection. Any collection without collection type gid as nil or assigned the default collection type are ignored.


62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/services/hyrax/collections/migration_service.rb', line 62

def self.repair_migrated_collections
  Deprecation.warn('This migration tool will be removed in Hyrax 4.0.0.')

  Rails.logger.info "*** Repairing migrated collections"
  ::Collection.all.each do |col|
    repair_migrated_collection(col)
    Rails.logger.info "  repairing collection - id: #{col.id}, title: #{col.title}"
  end
  AdminSet.all.each do |adminset|
    migrate_adminset(adminset)
    Rails.logger.info "  repairing adminset - id: #{adminset.id}, title: #{adminset.title}"
  end
  Rails.logger.info "--- Repairing Complete"
end