Skip to content

Commit

Permalink
Fix for Accessions not migrating if no repository with ID = 1 exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Stevens committed Jun 15, 2015
1 parent ed59ef0 commit f1f4502
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 22 additions & 2 deletions app/lib/migrate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion app/views/index.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Archon Migration Service 1.0.3 (03-13-2015)</h1>
<h1>Archon Migration Service 1.0.4 (06-11-2015)</h1>
<div class="pure-g">
<div id="form-wrapper" class="pure-u-1-2">
<%= ERB.new(File.read(File.dirname(__FILE__)+'/jobs/new.erb')).result(binding) %>
Expand Down

0 comments on commit f1f4502

Please sign in to comment.