[Satellite 6] upgrade fails on`foreman-rake db:migrate failed`

Solution Verified - Updated -

Issue

Running foreman-maintain upgrade run --target-version 6.4.z fails on error foreman-rake db:migrate failed!:

Execute db:migrate
== 20190205142619 AddContentConstraints: migrating ============================
-- change_column(:katello_product_contents, :content_id, :integer, {:null=>false})
   -> 0.0038s
-- change_column(:katello_product_contents, :product_id, :integer, {:null=>false})
   -> 0.0018s
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::ForeignKeyViolation: ERROR:  update or delete on table "katello_contents" violates foreign key constraint "katello_product_content_content_id_fk" on table "katello_product_contents" 
DETAIL:  Key (id)=(2403) is still referenced from table "katello_product_contents".
: DELETE FROM "katello_contents" WHERE "katello_contents"."id" = $1

Environment

Red Hat Satellite 6.4
Red Hat Satellite 6.5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content