Merge pull request #1138 from okriuchykhin/ok_SCI_2404

Disable some validations in repository import to improve speed [SCI-2404]
This commit is contained in:
okriuchykhin 2018-05-16 10:17:10 +02:00 committed by GitHub
commit a7547b9775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View file

@ -83,7 +83,7 @@ GEM
activemodel (= 5.1.1)
activesupport (= 5.1.1)
arel (~> 8.0)
activerecord-import (0.22.0)
activerecord-import (0.23.0)
activerecord (>= 3.2)
activesupport (5.1.1)
concurrent-ruby (~> 1.0, >= 1.0.2)

View file

@ -1,4 +1,6 @@
class RepositoryCell < ActiveRecord::Base
attr_accessor :importing
belongs_to :repository_row
belongs_to :repository_column
belongs_to :value, polymorphic: true,
@ -28,7 +30,8 @@ class RepositoryCell < ActiveRecord::Base
validates :repository_column, presence: true
validate :repository_column_data_type
validates :repository_row,
uniqueness: { scope: :repository_column }
uniqueness: { scope: :repository_column },
unless: :importing
private

View file

@ -94,6 +94,7 @@ module RepositoryImportParser
cell_value_resolver.column_list_items_size
end
next if cell_value.nil? # checks the case if we reach items limit
cell_value.repository_cell.importing = true
unless cell_value.valid?
errors = true
raise ActiveRecord::Rollback