Bug 2118738

Summary: 20211220185935_clean_duplicate_content_units db:migrate fails with child records
Product: Red Hat Satellite Reporter: Samir Jha <sajha>
Component: UpgradesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Lukas Pramuk <lpramuk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.10.0   
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-16 15:23:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Samir Jha 2022-08-16 15:16:55 UTC
During db:migrate the database patch 20211220185935_clean_duplicate_content_units.rb is applied, but fails with the following error in /var/log/foreman-installer/katello.log:

<pre>
2022-06-07 08:48:45 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::ForeignKeyViolation: ERROR:  update or delete on table "katello_module_profiles" violates foreign key constraint "katello_mod_profile_rpm_mod_profile_id_fk" on table "katello_module_profile_rpms"
2022-06-07 08:48:45 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: DETAIL:  Key (id)=(22) is still referenced from table "katello_module_profile_rpms".
</pre>

More details here: https://community.theforeman.org/t/foreignkeyviolation-on-katello-module-profiles-during-db-migrate/28926

Comment 1 Samir Jha 2022-08-16 15:16:59 UTC
Created from redmine issue https://projects.theforeman.org/issues/35031

Comment 2 Samir Jha 2022-08-16 15:17:00 UTC
Upstream bug assigned to None