bulkrax 3.0.0.beta3 → 3.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 144e5a05fdf0d22faa759b2f8529ec971af9001f10c8bbe74d705d954b85e048
4
- data.tar.gz: 569cdb00a7f533e5b0e234079d5e2ae0996f7c5230675fec158ce62c06a82987
3
+ metadata.gz: 744a122509bc57b9b9a24367c2eee3660d3184bd8209543de43e7f9bf3b1c6ef
4
+ data.tar.gz: c9156dba83a463872cf700d93d12770b5967a1e28f269aba0141d0ae9a280e8e
5
5
  SHA512:
6
- metadata.gz: 961ef2fcaccad86d47563de89538446a3757b54cd1abbaabe81e2479b902088ea62a06181fa22819e37df52cd6a32ce4a6c52892cd57ef89983b09a8bea403ef
7
- data.tar.gz: 432704c4491eef71eb3a3bc4a294d13b9fa4e08b616c031a71510579919cdde96fa06d697f096016858725f6abf6d4a77414b2533f7aaeaa863e9031725f7ce5
6
+ metadata.gz: 3abe5abd1a882ebe4090a75c8600a9c9e35ede83fdaab22aaf33966d5b412fc256835ccef6ab7eaf3776f5ff7a4b0c27eaf94ac77fccf99985b7ad1dc2172c78
7
+ data.tar.gz: 6f1387ce3876c65f23b15cb0cf6824040af2071f59a7f2c3d68377c78994d543f1bd7beced5a334e9467bc7285c1930da9acc6ac7c9e2fdddbdcd0b156541386
@@ -7,10 +7,10 @@ module Bulkrax
7
7
  include DynamicRecordLookup
8
8
 
9
9
  define_model_callbacks :save, :create
10
- attr_reader :attributes, :object, :source_identifier_value, :klass, :replace_files, :update_files, :work_identifier, :related_parents_parsed_mapping
10
+ attr_reader :attributes, :object, :source_identifier_value, :klass, :replace_files, :update_files, :work_identifier, :related_parents_parsed_mapping, :importer_run_id
11
11
 
12
12
  # rubocop:disable Metrics/ParameterLists
13
- def initialize(attributes:, source_identifier_value:, work_identifier:, related_parents_parsed_mapping: nil, replace_files: false, user: nil, klass: nil, update_files: false)
13
+ def initialize(attributes:, source_identifier_value:, work_identifier:, related_parents_parsed_mapping: nil, replace_files: false, user: nil, klass: nil, importer_run_id: nil, update_files: false)
14
14
  @attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes)
15
15
  @replace_files = replace_files
16
16
  @update_files = update_files
@@ -19,6 +19,7 @@ module Bulkrax
19
19
  @related_parents_parsed_mapping = related_parents_parsed_mapping
20
20
  @source_identifier_value = source_identifier_value
21
21
  @klass = klass || Bulkrax.default_work_type.constantize
22
+ @importer_run_id = importer_run_id
22
23
  end
23
24
  # rubocop:enable Metrics/ParameterLists
24
25
 
@@ -137,23 +138,25 @@ module Bulkrax
137
138
  end
138
139
 
139
140
  def create_collection(attrs)
141
+ attrs = clean_attrs(attrs)
140
142
  attrs = collection_type(attrs)
141
- persist_collection_memberships(parent: find_collection(attributes[related_parents_parsed_mapping]), child: object) if attributes[related_parents_parsed_mapping].present?
142
143
  object.attributes = attrs
143
144
  object.apply_depositor_metadata(@user)
144
145
  object.save!
146
+ pass_collection_to_be_persisted(parent: find_collection(attributes[related_parents_parsed_mapping]), child: object) if attributes[related_parents_parsed_mapping].present?
145
147
  end
146
148
 
147
149
  def update_collection(attrs)
148
- persist_collection_memberships(parent: find_collection(attributes[related_parents_parsed_mapping]), child: object) if attributes[related_parents_parsed_mapping].present?
149
150
  object.attributes = attrs
150
151
  object.save!
152
+ pass_collection_to_be_persisted(parent: find_collection(attributes[related_parents_parsed_mapping]), child: object) if attributes[related_parents_parsed_mapping].present?
151
153
  end
152
154
 
153
155
  # This method is heavily inspired by Hyrax's AttachFilesToWorkJob
154
156
  def create_file_set(attrs)
155
- work = find_record(attributes[related_parents_parsed_mapping].first)
157
+ _, work = find_record(attributes[related_parents_parsed_mapping].first, importer_run_id)
156
158
  work_permissions = work.permissions.map(&:to_hash)
159
+ attrs = clean_attrs(attrs)
157
160
  file_set_attrs = attrs.slice(*object.attributes.keys)
158
161
  object.assign_attributes(file_set_attrs)
159
162
 
@@ -179,9 +182,17 @@ module Bulkrax
179
182
  actor.update_metadata(file_set_attrs)
180
183
  end
181
184
 
185
+ def pass_collection_to_be_persisted(parent:, child:)
186
+ if parent.is_a? Array
187
+ parent.each { |par| persist_collection_memberships(par, child) }
188
+ else
189
+ persist_collection_memberships(parent, child)
190
+ end
191
+ end
192
+
182
193
  # Add child to parent's #member_collections
183
194
  # Add parent to child's #member_of_collections
184
- def persist_collection_memberships(parent:, child:)
195
+ def persist_collection_memberships(parent, child)
185
196
  parent.reject!(&:blank?) if parent.respond_to?(:reject!)
186
197
  child.reject!(&:blank?) if child.respond_to?(:reject!)
187
198
  return if parent.blank? || child.blank?
@@ -202,8 +213,16 @@ module Bulkrax
202
213
  end
203
214
  end
204
215
 
216
+ def clean_attrs(attrs)
217
+ # avoid the "ArgumentError: Identifier must be a string of size > 0 in order to be treeified" error
218
+ # when setting object.attributes
219
+ attrs.delete('id') if attrs['id'].blank?
220
+ attrs
221
+ end
222
+
205
223
  def collection_type(attrs)
206
224
  return attrs if attrs['collection_type_gid'].present?
225
+
207
226
  attrs['collection_type_gid'] = Hyrax::CollectionType.find_or_create_default_collection_type.gid
208
227
  attrs
209
228
  end
@@ -21,7 +21,7 @@ module Bulkrax
21
21
 
22
22
  queue_as :import
23
23
 
24
- attr_accessor :child_records, :parent_record, :parent_entry, :importer_run_id
24
+ attr_accessor :child_records, :child_entry, :parent_record, :parent_entry, :importer_run_id
25
25
 
26
26
  # @param parent_identifier [String] Work/Collection ID or Bulkrax::Entry source_identifiers
27
27
  # @param importer_run [Bulkrax::ImporterRun] current importer run (needed to properly update counters)
@@ -31,17 +31,17 @@ module Bulkrax
31
31
  # Whether the @base_entry is the parent or the child in the relationship is determined by the presence of a
32
32
  # parent_identifier or child_identifier param. For example, if a parent_identifier is passed, we know @base_entry
33
33
  # is the child in the relationship, and vice versa if a child_identifier is passed.
34
- def perform(parent_identifier:, importer_run_id:)
34
+ def perform(parent_identifier:, importer_run_id:) # rubocop:disable Metrics/AbcSize
35
35
  pending_relationships = Bulkrax::PendingRelationship.find_each.select do |rel|
36
36
  rel.bulkrax_importer_run_id == importer_run_id && rel.parent_id == parent_identifier
37
37
  end.sort_by(&:order)
38
38
 
39
39
  @importer_run_id = importer_run_id
40
- @parent_record = find_record(parent_identifier)
40
+ @parent_entry, @parent_record = find_record(parent_identifier, importer_run_id)
41
41
  @child_records = { works: [], collections: [] }
42
42
  pending_relationships.each do |rel|
43
43
  raise ::StandardError, %("#{rel}" needs either a child or a parent to create a relationship) if rel.child_id.nil? || rel.parent_id.nil?
44
- child_record = find_record(rel.child_id)
44
+ @child_entry, child_record = find_record(rel.child_id, importer_run_id)
45
45
  child_record.is_a?(::Collection) ? @child_records[:collections] << child_record : @child_records[:works] << child_record
46
46
  end
47
47
 
@@ -53,13 +53,13 @@ module Bulkrax
53
53
  return false # stop current job from continuing to run after rescheduling
54
54
  end
55
55
 
56
- @parent_entry = Bulkrax::Entry.where(identifier: parent_identifier,
57
- importerexporter_id: ImporterRun.find(importer_run_id).importer_id,
58
- importerexporter_type: "Bulkrax::Importer").first
56
+ @parent_entry ||= Bulkrax::Entry.where(identifier: parent_identifier,
57
+ importerexporter_id: ImporterRun.find(importer_run_id).importer_id,
58
+ importerexporter_type: "Bulkrax::Importer").first
59
59
  create_relationships
60
60
  pending_relationships.each(&:destroy)
61
61
  rescue ::StandardError => e
62
- parent_entry.status_info(e)
62
+ parent_entry ? parent_entry.status_info(e) : child_entry.status_info(e)
63
63
  Bulkrax::ImporterRun.find(importer_run_id).increment!(:failed_relationships) # rubocop:disable Rails/SkipsModelValidations
64
64
  end
65
65
 
@@ -87,11 +87,12 @@ module Bulkrax
87
87
  ObjectFactory.new(
88
88
  attributes: attrs,
89
89
  source_identifier_value: nil, # sending the :id in the attrs means the factory doesn't need a :source_identifier_value
90
- work_identifier: parent_entry.parser.work_identifier,
91
- related_parents_parsed_mapping: parent_entry.parser.related_parents_parsed_mapping,
90
+ work_identifier: parent_entry&.parser&.work_identifier,
91
+ related_parents_parsed_mapping: parent_entry&.parser&.related_parents_parsed_mapping,
92
92
  replace_files: false,
93
93
  user: user,
94
- klass: child_record.class
94
+ klass: child_record.class,
95
+ importer_run_id: importer_run_id
95
96
  ).run
96
97
  # TODO: add counters for :processed_parents and :failed_parents
97
98
  Bulkrax::ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
@@ -105,11 +106,12 @@ module Bulkrax
105
106
  ObjectFactory.new(
106
107
  attributes: attrs,
107
108
  source_identifier_value: nil, # sending the :id in the attrs means the factory doesn't need a :source_identifier_value
108
- work_identifier: parent_entry.parser.work_identifier,
109
- related_parents_parsed_mapping: parent_entry.parser.related_parents_parsed_mapping,
109
+ work_identifier: parent_entry&.parser&.work_identifier,
110
+ related_parents_parsed_mapping: parent_entry&.parser&.related_parents_parsed_mapping,
110
111
  replace_files: false,
111
112
  user: user,
112
- klass: parent_record.class
113
+ klass: parent_record.class,
114
+ importer_run_id: importer_run_id
113
115
  ).run
114
116
  # TODO: add counters for :processed_parents and :failed_parents
115
117
  Bulkrax::ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
@@ -128,11 +130,12 @@ module Bulkrax
128
130
  ObjectFactory.new(
129
131
  attributes: attrs,
130
132
  source_identifier_value: nil, # sending the :id in the attrs means the factory doesn't need a :source_identifier_value
131
- work_identifier: parent_entry.parser.work_identifier,
132
- related_parents_parsed_mapping: parent_entry.parser.related_parents_parsed_mapping,
133
+ work_identifier: parent_entry&.parser&.work_identifier,
134
+ related_parents_parsed_mapping: parent_entry&.parser&.related_parents_parsed_mapping,
133
135
  replace_files: false,
134
136
  user: user,
135
- klass: parent_record.class
137
+ klass: parent_record.class,
138
+ importer_run_id: importer_run_id
136
139
  ).run
137
140
  # TODO: add counters for :processed_parents and :failed_parents
138
141
  Bulkrax::ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
@@ -7,7 +7,10 @@ module Bulkrax
7
7
 
8
8
  queue_as :import
9
9
 
10
+ attr_reader :importer_run_id
11
+
10
12
  def perform(entry_id, importer_run_id)
13
+ @importer_run_id = importer_run_id
11
14
  entry = Entry.find(entry_id)
12
15
  parent_identifier = entry.raw_metadata[entry.related_parents_raw_mapping]&.strip
13
16
 
@@ -63,7 +66,8 @@ module Bulkrax
63
66
  end
64
67
 
65
68
  def find_parent_record(parent_identifier)
66
- @parent_record ||= find_record(parent_identifier)
69
+ @parent_record ||= find_record(parent_identifier, importer_run_id)
70
+ @parent_record = parent_record.last if parent_record.is_a? Array
67
71
  end
68
72
  end
69
73
  end
@@ -41,6 +41,8 @@ module Bulkrax
41
41
  self.parsed_metadata = {}
42
42
  add_identifier
43
43
  add_ingested_metadata
44
+ # TODO(alishaevn): remove the collections stuff entirely and only reference collections via the new parents code
45
+ add_collections
44
46
  add_visibility
45
47
  add_metadata_for_model
46
48
  add_rights_statement
@@ -57,6 +59,7 @@ module Bulkrax
57
59
  if factory_class == Collection
58
60
  add_collection_type_gid
59
61
  elsif factory_class == FileSet
62
+ validate_presence_of_filename!
60
63
  add_path_to_file
61
64
  validate_presence_of_parent!
62
65
  else
@@ -238,35 +241,40 @@ module Bulkrax
238
241
  Bulkrax::CsvMatcher
239
242
  end
240
243
 
241
- def possible_collection_ids
242
- return @possible_collection_ids if @possible_collection_ids.present?
244
+ def collection_identifiers
245
+ return @collection_identifiers if @collection_identifiers.present?
243
246
 
244
- collection_field_mapping = self.class.parent_field(parser)
245
- return [] unless collection_field_mapping.present? && record[collection_field_mapping].present?
247
+ parent_field_mapping = self.class.parent_field(parser)
248
+ return [] unless parent_field_mapping.present? && record[parent_field_mapping].present?
246
249
 
247
250
  identifiers = []
248
- split_titles = record[collection_field_mapping].split(/\s*[;|]\s*/)
249
- split_titles.each do |c_title|
250
- matching_collection_entries = importerexporter.entries.select { |e| e.raw_metadata['title'] == c_title }
251
+ split_references = record[parent_field_mapping].split(/\s*[;|]\s*/)
252
+ split_references.each do |c_reference|
253
+ matching_collection_entries = importerexporter.entries.select do |e|
254
+ (e.raw_metadata&.[](source_identifier) == c_reference) &&
255
+ e.is_a?(CsvCollectionEntry)
256
+ end
251
257
  raise ::StandardError, 'Only expected to find one matching entry' if matching_collection_entries.count > 1
252
258
  identifiers << matching_collection_entries.first&.identifier
253
259
  end
254
- @possible_collection_ids = identifiers.compact.presence || []
260
+
261
+ @collection_identifiers = identifiers.compact.presence || []
255
262
  end
256
263
 
257
264
  def collections_created?
258
- possible_collection_ids.length == self.collection_ids.length
265
+ collection_identifiers.length == self.collection_ids.length
259
266
  end
260
267
 
261
268
  def find_collection_ids
262
269
  return self.collection_ids if collections_created?
263
- if possible_collection_ids.present?
264
- possible_collection_ids.each do |collection_id|
270
+ if collection_identifiers.present?
271
+ collection_identifiers.each do |collection_id|
265
272
  c = find_collection(collection_id)
266
273
  skip = c.blank? || self.collection_ids.include?(c.id)
267
274
  self.collection_ids << c.id unless skip
268
275
  end
269
276
  end
277
+
270
278
  self.collection_ids
271
279
  end
272
280
 
@@ -17,6 +17,12 @@ module Bulkrax
17
17
  parsed_metadata['file']
18
18
  end
19
19
 
20
+ def validate_presence_of_filename!
21
+ return if parsed_metadata&.[]('file')&.map(&:present?)&.any?
22
+
23
+ raise StandardError, 'File set must have a filename'
24
+ end
25
+
20
26
  def validate_presence_of_parent!
21
27
  return if parsed_metadata[related_parents_parsed_mapping]&.map(&:present?)&.any?
22
28
 
@@ -5,6 +5,8 @@ module Bulkrax
5
5
  belongs_to :importer
6
6
  has_many :statuses, as: :runnable, dependent: :destroy
7
7
 
8
- serialize :parents, Array
8
+ def parents
9
+ PendingRelationship.where(bulkrax_importer_run_id: id).pluck(:parent_id).uniq
10
+ end
9
11
  end
10
12
  end
@@ -6,9 +6,16 @@ module Bulkrax
6
6
  # has the provided identifier.
7
7
  #
8
8
  # @param identifier [String] Work/Collection ID or Bulkrax::Entry source_identifier
9
- # @return [Work, Collection, nil] Work or Collection if found, otherwise nil
10
- def find_record(identifier)
11
- record = Entry.find_by(identifier: identifier)
9
+ # @param importer_run_id [Number] ID of the current_run of this Importer Job
10
+ # @return [Entry, nil], [Work, Collection, nil] Entry if found, otherwise nil and a Work or Collection if found, otherwise nil
11
+ def find_record(identifier, importer_run_id = nil)
12
+ # check for our entry in our current importer first
13
+ importer_id = ImporterRun.find(importer_run_id).importer_id
14
+ default_scope = { identifier: identifier, importerexporter_type: 'Bulkrax::Importer' }
15
+ record = Entry.find_by(default_scope, importerexporter_id: importer_id) || Entry.find_by(default_scope)
16
+
17
+ # TODO(alishaevn): discuss whether we are only looking for Collection models here
18
+ # use ActiveFedora::Base.find(identifier) instead?
12
19
  record ||= ::Collection.where(id: identifier).first # rubocop:disable Rails/FindBy
13
20
  if record.blank?
14
21
  available_work_types.each do |work_type|
@@ -16,7 +23,9 @@ module Bulkrax
16
23
  end
17
24
  end
18
25
 
19
- record.is_a?(Entry) ? record.factory.find : record
26
+ # return the found entry here instead of searching for it again in the CreateRelationshipsJob
27
+ # also accounts for when the found entry isn't a part of this importer
28
+ record.is_a?(Entry) ? [record, record.factory.find] : [nil, record]
20
29
  end
21
30
 
22
31
  # Check if the record is a Work
@@ -45,6 +45,8 @@ module Bulkrax
45
45
  end
46
46
 
47
47
  def new_remote_files
48
+ return if object.is_a? FileSet
49
+
48
50
  @new_remote_files ||= if object.present? && object.file_sets.present?
49
51
  parsed_remote_files.select do |file|
50
52
  # is the url valid?
@@ -101,7 +103,12 @@ module Bulkrax
101
103
  end
102
104
 
103
105
  def local_file_sets
104
- @local_file_sets ||= object&.ordered_file_sets
106
+ @local_file_sets ||= ordered_file_sets
107
+ end
108
+
109
+ def ordered_file_sets
110
+ # OVERRIDE Hyrda-works 1.2.0 - this method was deprecated in v1.0
111
+ object&.ordered_members.to_a.select(&:file_set?)
105
112
  end
106
113
 
107
114
  def import_files
@@ -28,7 +28,6 @@ module Bulkrax
28
28
  self.parsed_metadata[related_parents_parsed_mapping].each do |parent_identifier|
29
29
  next if parent_identifier.blank?
30
30
 
31
- add_parent_to_import_run(parent_identifier, importerexporter.last_run)
32
31
  PendingRelationship.create!(child_id: self.identifier, parent_id: parent_identifier, bulkrax_importer_run_id: importerexporter.last_run.id, order: self.id)
33
32
  end
34
33
  end
@@ -37,16 +36,10 @@ module Bulkrax
37
36
  self.parsed_metadata[related_children_parsed_mapping].each do |child_identifier|
38
37
  next if child_identifier.blank?
39
38
 
40
- add_parent_to_import_run(self.identifier, importerexporter.last_run)
41
39
  PendingRelationship.create!(parent_id: self.identifier, child_id: child_identifier, bulkrax_importer_run_id: importerexporter.last_run.id, order: self.id)
42
40
  end
43
41
  end
44
42
 
45
- def add_parent_to_import_run(parent_id, run)
46
- run.parents << parent_id
47
- run.save
48
- end
49
-
50
43
  def find_collection_ids
51
44
  self.collection_ids
52
45
  end
@@ -98,6 +91,7 @@ module Bulkrax
98
91
  replace_files: replace_files,
99
92
  user: user,
100
93
  klass: factory_class,
94
+ importer_run_id: importerexporter.last_run.id,
101
95
  update_files: update_files)
102
96
  end
103
97
 
@@ -193,7 +193,7 @@ module Bulkrax
193
193
  instance_variable_set(instance_var, ActiveFedora::SolrService.post(
194
194
  extra_filters.to_s,
195
195
  fq: [
196
- "#{work_identifier}_sim:(#{complete_entry_identifiers.join(' OR ')})",
196
+ "#{::Solrizer.solr_name(work_identifier)}:(#{complete_entry_identifiers.join(' OR ')})",
197
197
  "has_model_ssim:(#{models_to_search.join(' OR ')})"
198
198
  ],
199
199
  fl: 'id',
@@ -79,13 +79,12 @@
79
79
  <%= @exporter.exporter_runs.last&.total_work_entries %>
80
80
  </p>
81
81
  <br>
82
- <div class="bulkrax-nav-tab-table-left-align">
82
+ <div class='bulkrax-nav-tab-table-left-align'>
83
83
  <h2>Entries</h2>
84
84
  <table class='table table-striped'>
85
85
  <thead>
86
86
  <tr>
87
87
  <th>Identifier</th>
88
- <th>Collection</th>
89
88
  <th>Entry ID</th>
90
89
  <th>Status</th>
91
90
  <th>Errors</th>
@@ -97,17 +96,12 @@
97
96
  <% @work_entries.each do |e| %>
98
97
  <tr>
99
98
  <td><%= link_to e.identifier, bulkrax.exporter_entry_path(@exporter.id, e.id) %></td>
100
- <% if e.parsed_metadata.present? && e.parsed_metadata.dig('collections').present? %>
101
- <td><%= e.parsed_metadata.dig('collections').map {|c| c['id'] }.join('; ') %></td>
102
- <% elsif e.raw_metadata.present? %>
103
- <td><%= Array.wrap(e.raw_metadata.dig('collection')).join(';') %></td>
104
- <% else %>
105
- <td></td>
106
- <% end %>
107
99
  <td><%= e.id %></td>
108
100
  <% if e.status == 'Complete' %>
109
101
  <td><span class='glyphicon glyphicon-ok' style='color: green;'></span> <%= e.status %></td>
110
- <% else %>
102
+ <% elsif e.status == 'Pending' %>
103
+ <td><span class='glyphicon glyphicon-option-horizontal' style='color: blue;'></span> <%= e.status %></td>
104
+ <% else %>
111
105
  <td><span class='glyphicon glyphicon-remove' style='color: red;'></span> <%= e.status %></td>
112
106
  <% end %>
113
107
  <% if e.last_error.present? %>
@@ -85,7 +85,6 @@
85
85
  <thead>
86
86
  <tr>
87
87
  <th>Identifier</th>
88
- <th>Collection</th>
89
88
  <th>Entry ID</th>
90
89
  <th>Status</th>
91
90
  <th>Errors</th>
@@ -97,13 +96,6 @@
97
96
  <% @work_entries.each do |e| %>
98
97
  <tr>
99
98
  <td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
100
- <% if e.parsed_metadata.present? && e.parsed_metadata.dig("collections").present? %>
101
- <td><%= e.parsed_metadata.dig("collections").map {|c| c['id'] }.join('; ') %></td>
102
- <% elsif e.raw_metadata.present? %>
103
- <td><%= Array.wrap(e.raw_metadata.dig("collection")).join(';') %></td>
104
- <% else %>
105
- <td></td>
106
- <% end %>
107
99
  <td><%= e.id %></td>
108
100
  <% if e.status == "Complete" %>
109
101
  <td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
@@ -183,6 +175,8 @@
183
175
  <td><%= e.id %></td>
184
176
  <% if e.status == "Complete" %>
185
177
  <td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
178
+ <% elsif e.status == "Pending" %>
179
+ <td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
186
180
  <% else %>
187
181
  <td><span class="glyphicon glyphicon-remove" style="color: red;"></span> <%= e.status %></td>
188
182
  <% end %>
@@ -1,6 +1,6 @@
1
1
  class RenameChildrenCountersToRelationships < ActiveRecord::Migration[5.2]
2
2
  def change
3
- rename_column :bulkrax_importer_runs, :processed_children, :processed_relationships
4
- rename_column :bulkrax_importer_runs, :failed_children, :failed_relationships
3
+ rename_column :bulkrax_importer_runs, :processed_children, :processed_relationships unless column_exists?(:bulkrax_importer_runs, :processed_relationships)
4
+ rename_column :bulkrax_importer_runs, :failed_children, :failed_relationships unless column_exists?(:bulkrax_importer_runs, :failed_relationships)
5
5
  end
6
6
  end
@@ -1,11 +1,13 @@
1
1
  class CreateBulkraxPendingRelationships < ActiveRecord::Migration[5.2]
2
2
  def change
3
- create_table :bulkrax_pending_relationships do |t|
4
- t.belongs_to :bulkrax_importer_run, foreign_key: true, null: false
5
- t.string :parent_id, null: false
6
- t.string :child_id, null: false
3
+ unless table_exists?(:bulkrax_pending_relationships)
4
+ create_table :bulkrax_pending_relationships do |t|
5
+ t.belongs_to :bulkrax_importer_run, foreign_key: true, null: false
6
+ t.string :parent_id, null: false
7
+ t.string :child_id, null: false
7
8
 
8
- t.timestamps
9
+ t.timestamps
10
+ end
9
11
  end
10
12
  end
11
13
  end
@@ -1,5 +1,5 @@
1
1
  class AddOrderToBulkraxPendingRelationships < ActiveRecord::Migration[5.2]
2
2
  def change
3
- add_column :bulkrax_pending_relationships, :order, :integer, default: 0
3
+ add_column :bulkrax_pending_relationships, :order, :integer, default: 0 unless column_exists?(:bulkrax_pending_relationships, :order)
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '3.0.0.beta3'
4
+ VERSION = '3.0.0.beta6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta3
4
+ version: 3.0.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-30 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -366,9 +366,7 @@ files:
366
366
  - db/migrate/20220118001339_add_import_attempts_to_entries.rb
367
367
  - db/migrate/20220119213325_add_work_counters_to_importer_runs.rb
368
368
  - db/migrate/20220301001839_create_bulkrax_pending_relationships.rb
369
- - db/migrate/20220301020307_add_parents_to_bulkrax_importer_runs.rb
370
369
  - db/migrate/20220303212810_add_order_to_bulkrax_pending_relationships.rb
371
- - db/migrate/20220330165510_remove_array_true_from_importer_run_parents_column.rb
372
370
  - lib/bulkrax.rb
373
371
  - lib/bulkrax/engine.rb
374
372
  - lib/bulkrax/version.rb
@@ -1,5 +0,0 @@
1
- class AddParentsToBulkraxImporterRuns < ActiveRecord::Migration[5.1]
2
- def change
3
- add_column :bulkrax_importer_runs, :parents, :text, array: true
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class RemoveArrayTrueFromImporterRunParentsColumn < ActiveRecord::Migration[5.2]
2
- def change
3
- change_column :bulkrax_importer_runs, :parents, :text, array: false, default: nil
4
- end
5
- end