Add organization transfer support for ai_catalog_item_version_dependencies

ai_catalog_item_versions is auto-discovered by Organizations::Transfer::UsersService.migratable_models (it has both a User and an Organization association) and moves with the user who created the version. ai_catalog_item_version_dependencies rows only have a version association, so they stayed behind in the old organization.

This MR transfers the dependency rows alongside the versions of the transferring users in the EE UsersService override, using update_organization_id_for, and marks the table as supported in config/organizations/transfer_support.yml.

Specs follow the existing ai_conversation_messages context: moved for group users, untouched for non-group users and other organizations, and the batched-queries shared example with batch size 1.

Resolves #616251

Differences

Before: After a user transfer, ai_catalog_item_versions.organization_id points at the new organization while the version's ai_catalog_item_version_dependencies rows still point at the old one.

After: Dependencies move with their version, and the registry entry is supported.

How to set up and Validate locally:

  1. bundle exec rspec ee/spec/services/ee/organizations/transfer/users_service_spec.rb
  2. bundle exec rspec spec/lib/gitlab/organizations/organization_transfer_support_spec.rb
Edited by Jeston Singh

Merge request reports

Loading
Loading