inventory_refresh 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/lib/inventory_refresh/inventory_collection.rb +13 -1
- data/lib/inventory_refresh/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b10eefddb6c6047733a621b97d2c70c6d052631bedaf60b2a7576ea6aaa51d14
|
4
|
+
data.tar.gz: 0604db9347d58b247ff49a2ce6c0babb18aabec4f83e9229f4dbe128b5274b02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d8ad459489ab9bccc1b1782c68798002bac2d40efbb3e1f9f1e9b604a68926a48ba9872060c602463b5d874d56cc00e0ce02365a5297b5fa42a1288cd45188a
|
7
|
+
data.tar.gz: d2b2524881deed9627a09c39db3265fcfc0bc11e1fdd4efea68a4c841dff3c62b890a12c243226c7419a775128f54808f9ce008f1f0e0661abf0498bc0ca1b1b
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @agrare @Fryguy @Ladas @slemrmartin
|
@@ -342,13 +342,25 @@ module InventoryRefresh
|
|
342
342
|
#
|
343
343
|
# @return [Array<Symbol>] attributes that are needed for saving of the record
|
344
344
|
def fixed_attributes
|
345
|
+
not_null_attributes = []
|
346
|
+
|
345
347
|
if model_class
|
348
|
+
# Attrs having presence validator
|
346
349
|
presence_validators = model_class.validators.detect { |x| x.kind_of?(ActiveRecord::Validations::PresenceValidator) }
|
350
|
+
not_null_attributes += presence_validators.attributes if presence_validators.present?
|
351
|
+
|
352
|
+
# Column names having NOT NULL constraint
|
353
|
+
non_null_constraints = model_class.columns_hash.values.reject(&:null).map(&:name) - [model_class.primary_key]
|
354
|
+
not_null_attributes += non_null_constraints.map(&:to_sym)
|
355
|
+
|
356
|
+
# Column names having NOT NULL constraint transformed to relation names
|
357
|
+
not_null_attributes += non_null_constraints.map {|x| foreign_key_to_association_mapping[x]}.compact
|
347
358
|
end
|
348
359
|
# Attributes that has to be always on the entity, so attributes making unique index of the record + attributes
|
349
360
|
# that have presence validation
|
361
|
+
|
350
362
|
fixed_attributes = manager_ref
|
351
|
-
fixed_attributes +=
|
363
|
+
fixed_attributes += not_null_attributes.uniq
|
352
364
|
fixed_attributes
|
353
365
|
end
|
354
366
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inventory_refresh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -143,6 +143,7 @@ extensions: []
|
|
143
143
|
extra_rdoc_files: []
|
144
144
|
files:
|
145
145
|
- ".codeclimate.yml"
|
146
|
+
- ".github/CODEOWNERS"
|
146
147
|
- ".gitignore"
|
147
148
|
- ".rspec"
|
148
149
|
- ".rspec_ci"
|
@@ -221,8 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
222
|
- !ruby/object:Gem::Version
|
222
223
|
version: '0'
|
223
224
|
requirements: []
|
224
|
-
|
225
|
-
rubygems_version: 2.7.6.2
|
225
|
+
rubygems_version: 3.1.2
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: Topological Inventory Persister
|