Loading
Background migration: Update step_url from company path
What does this MR do and why?
Adds a post-deployment background migration to update user_details.onboarding_status.step_url values from either /users/sign_up/company or /users/sign_up/groups/new to /users/sign_up/welcome.
Relates to https://gitlab.com/gitlab-org/gitlab/-/work_items/593994.
Files added:
lib/gitlab/background_migration/update_step_url_to_welcome_path.rb— BBM class that updates matchingstep_urlvalues in batchesdb/post_migrate/20260715142246_queue_update_step_url_to_welcome_path.rb— post-deployment migration that queues the BBMdb/docs/batched_background_migrations/update_step_url_to_welcome_path.yml— BBM dictionary entryspec/lib/gitlab/background_migration/update_step_url_to_welcome_path_spec.rb— BBM specspec/migrations/20260715142246_queue_update_step_url_to_welcome_path_spec.rb— queue migration spec
Query related
Estimated 2.7 million rows to update: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/52139/commands/153587.
Example update query:
UPDATE "user_details"
SET "onboarding_status" = jsonb_set(
onboarding_status,
'{step_url}',
'"/users/sign_up/welcome"'::jsonb
)
WHERE "user_details"."user_id" >= 1
AND "user_details"."user_id" < 251
AND (onboarding_status ->> 'step_url' IN ('/users/sign_up/company', '/users/sign_up/groups/new'));Query plan: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/52139/commands/153590
How to set up and validate locally
- In a rails console, create a user with
step_urlset to one of the old paths:user = User.last user.update!(onboarding_status_step_url: '/users/sign_up/company') - Run the migration:
Gitlab::BackgroundMigration::UpdateStepUrlToWelcomePath.new( start_id: user.user_detail.user_id, end_id: user.user_detail.user_id, batch_table: :user_details, batch_column: :user_id, sub_batch_size: 100, pause_ms: 0, connection: ApplicationRecord.connection ).perform - Verify the
step_urlwas updated:user.reload.onboarding_status_step_url # => "/users/sign_up/welcome"
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Roy Liu