diff --git a/app/lib/migrate.rb b/app/lib/migrate.rb index b2dbcc8d..fb18fe08 100644 --- a/app/lib/migrate.rb +++ b/app/lib/migrate.rb @@ -77,16 +77,36 @@ def migrate(y) # 3: Global scope objects (agents and subjects) @globals_map = migrate_creators_and_subjects - # 4: Iterate through repositories + # 4: since it's possible that no repository with ID = 1 + # exists in the Archon database, we need to set the default repository to + # the one with the lowest number, otherwise no Accessions records will migrate + set_default_repository + + # 5: Iterate through repositories @repo_map.each do |archon_repo_id, aspace_repo_uri| migrate_repository(archon_repo_id, aspace_repo_uri) end - # 5: Package Digital File content for Download + # 6: Package Digital File content for Download package_digital_files emit_status("Migration complete. Download the log to review warnings") end + # method to set the default repository id + def set_default_repository() + smallest_repo_id = 100 + + @repo_map.keys.each do |archon_repo_id| + if(archon_repo_id.to_i < smallest_repo_id) + smallest_repo_id = archon_repo_id.to_i + end + end + + if(@args[:default_repository] != smallest_repo_id.to_s) + @args[:default_repository] = smallest_repo_id.to_s + emit_status("Default Repository ID Reset to #{smallest_repo_id}") + end + end def migrate_repository(archon_repo_id, aspace_repo_uri) emit_status("Migrating Repository #{archon_repo_id}") diff --git a/app/views/index.erb b/app/views/index.erb index 433c92ac..15ae2156 100644 --- a/app/views/index.erb +++ b/app/views/index.erb @@ -1,4 +1,4 @@ -

Archon Migration Service 1.0.3 (03-13-2015)

+

Archon Migration Service 1.0.4 (06-11-2015)

<%= ERB.new(File.read(File.dirname(__FILE__)+'/jobs/new.erb')).result(binding) %>