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
:
-
Create a new entry in the
packages_nuget_symbol
table withoutproject_id
# stub file upload def fixture_file_upload(*args, **kwargs) Rack::Test::UploadedFile.new(*args, **kwargs) end symbol = FactoryBot.create(:nuget_symbol)
-
Execute the migrations
$ rails db:migrate:up:main
-
Give sidekiq a bit time to process the job and verify that the
project_id
column was backfilledPackages::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