Files
gitlab-foss/lib/gitlab/background_migration/migrate_scim_tokens.rb
2025-01-13 15:32:43 +00:00

22 lines
681 B
Ruby

# frozen_string_literal: true
module Gitlab
module BackgroundMigration
class MigrateScimTokens < BatchedMigrationJob
operation_name :migrate_scim_tokens
scope_to ->(relation) { relation.where.not(group_id: nil) }
feature_category :system_access
def perform
each_sub_batch do |sub_batch|
connection.execute <<-SQL
INSERT INTO group_scim_auth_access_tokens (temp_source_id, group_id, token_encrypted, created_at, updated_at)
#{sub_batch.select(:id, :group_id, 'token_encrypted::bytea', :created_at, :updated_at).to_sql}
ON CONFLICT DO NOTHING
SQL
end
end
end
end
end