Refresh packages_size on project_statistics table

Problem to solve

The GitLab Package Registry allows users to build, publish and share packages across a variety of formats. Packages can be built and pushed to the users registry using the command line or their pipelines.

In order to provide visibility into how storage is being used in a given project, we provide a dashboard which displays storage usage for each package manager format. However, packages deleted before #12583 (closed) are not reflected in ProjectStatistics#packages_size.

Intended users

  • Sidney (Systems Administrator)

Proposal

  • Write a background migration that refreshes this table.

Further details

Implementation details

  • We already have a similar migration in db/post_migrate/20190418132125_populate_project_statistics_packages_size.rb, but it needs a new on SQL on line 32 and in the corresponding down method.
# on line 32 and 39
storage_size = Arel.sql('(repository_size + lfs_objects_size + build_artifacts_size + packages_size + COALESCE(wiki_size, 0))')
Edited Oct 08, 2019 by Tim Rizzi
Assignee Loading
Time tracking Loading