Class: BulkImports::Export

Inherits:
ApplicationRecord show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/models/bulk_imports/export.rb

Constant Summary collapse

STARTED =
0
FINISHED =
1
FAILED =
-1

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Instance Method Summary collapse

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, nullable_column?, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Instance Method Details

#configObject



70
71
72
73
74
# File 'app/models/bulk_imports/export.rb', line 70

def config
  strong_memoize(:config) do
    FileTransfer.config_for(portable)
  end
end

#portableObject



60
61
62
63
64
# File 'app/models/bulk_imports/export.rb', line 60

def portable
  strong_memoize(:portable) do
    project || group
  end
end

#portable_relation?Boolean

Returns:

  • (Boolean)


54
55
56
57
58
# File 'app/models/bulk_imports/export.rb', line 54

def portable_relation?
  return unless portable

  errors.add(:relation, 'Unsupported portable relation') unless config.portable_relations.include?(relation)
end

#relation_definitionObject



66
67
68
# File 'app/models/bulk_imports/export.rb', line 66

def relation_definition
  config.relation_definition_for(relation)
end

#relation_has_user_contributions?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'app/models/bulk_imports/export.rb', line 83

def relation_has_user_contributions?
  config.relation_has_user_contributions?(relation)
end

#remove_existing_upload!Object



76
77
78
79
80
81
# File 'app/models/bulk_imports/export.rb', line 76

def remove_existing_upload!
  return unless upload&.export_file&.file

  upload.remove_export_file!
  upload.save!
end