Skip to content

Add project_id to nuget symbols

What does this MR do and why?

This MR adds project_id column to the packages_nuget_symbols table, that will be used as a sharding key later, and the background migration to backfill project_id from packages_packages table.

There're ~190K rows in the packages_nuget_symbols link (internal) that needs to get project_id backfilled.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

No.

How to set up and validate locally

In rails console:

  1. Create a new entry in the packages_nuget_symbol table without project_id

    # stub file upload
    def fixture_file_upload(*args, **kwargs)
      Rack::Test::UploadedFile.new(*args, **kwargs)
    end
    
    symbol = FactoryBot.create(:nuget_symbol)
  2. Execute the migrations

    $ rails db:migrate:up:main
  3. Give sidekiq a bit time to process the job and verify that the project_id column was backfilled

    Packages::Nuget::Symbol.find(symbol.id)

    To verify the background migration status visit http://gdk.test:3000/admin/background_migrations

    When the background job wasn't executed for a long time, it's possible to trigger it manually using Database::BatchedBackgroundMigrationWorker.perform_async

Related to #461803

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading