-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add data migration to nullify target fields on bs_request_actions #17324
Add data migration to nullify target fields on bs_request_actions #17324
Conversation
304b696
to
0176bd9
Compare
src/api/db/data/20250131094818_nullify_targets_on_bs_request_actions.rb
Outdated
Show resolved
Hide resolved
9e2204c
to
da95a70
Compare
da95a70
to
dbf6713
Compare
src/api/db/data/20250131094818_nullify_targets_on_bs_request_actions.rb
Outdated
Show resolved
Hide resolved
src/api/db/data/20250131094818_nullify_targets_on_bs_request_actions.rb
Outdated
Show resolved
Hide resolved
On Montag, 3. Februar 2025, 11:17:56 CET Eduardo J. wrote:
@eduardoj commented on this pull request.
> @@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+class NullifyTargetsOnBsRequestActions < ActiveRecord::Migration[7.0]
+ # rubocop:disable Rails/SkipsModelValidations
+ def up
+ bs_request_actions = BsRequestAction.where('target_project_id IS NOT NULL AND target_package_id IS NULL')
+ bs_request_actions.in_batches do |batch|
+ batch.find_each do |action|
+ target_project = Project.find_by_name(action.target_project)
Hm... Do we really want to skip remote projects?
you can never have a remote target project at least.
Also, be sure not to loose informations. We must keep the information
about the request source/target, even when the projects or packages
get removed.
…--
Adrian Schroeter ***@***.***>
Build Infrastructure Project Manager
SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nürnberg, Germany
(HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
|
Ok, then we are safe with applying
That information will be kept (and never touched) in the string fields |
Nullify `target_project_id` and `target_package_id` in `bs_request_actions` if the project or/and package no longer exist.
dbf6713
to
928524f
Compare
Nullify
target_project_id
andtarget_package_id
inbs_request_actions
if the project or/and package no longer exist.Follow-up to #17310.