Class: Gitlab::BackgroundMigration::FixIncoherentPackagesSizeOnProjectStatistics::PackageFile

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
lib/gitlab/background_migration/fix_incoherent_packages_size_on_project_statistics.rb

Constant Summary

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Class 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, 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 SensitiveSerializableHash

#serializable_hash

Class Method Details

.sum_queryObject



81
82
83
84
85
86
87
88
89
# File 'lib/gitlab/background_migration/fix_incoherent_packages_size_on_project_statistics.rb', line 81

def self.sum_query
  packages = FixIncoherentPackagesSizeOnProjectStatistics::Package.arel_table
  stats = FixIncoherentPackagesSizeOnProjectStatistics::ProjectStatistics.arel_table

  joins(:package)
    .where(packages[:project_id].eq(stats[:project_id]))
    .where.not(size: nil)
    .select('SUM(packages_package_files.size) as total')
end