Bug 1762346
| Summary: | Upgrade from 6.4 to 6.5 fails at db:migrate Due to 20190205142619_add_content_constraints Migration | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | roarora |
| Component: | Content Management | Assignee: | Partha Aji <paji> |
| Status: | CLOSED ERRATA | QA Contact: | Lai <ltran> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.5.0 | CC: | inecas, mbacovsk, mmccune |
| Target Milestone: | 6.9.0 | Keywords: | Triaged, Upgrades |
| Target Release: | Unused | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-04-21 13:12:13 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
roarora
2019-10-16 15:10:23 UTC
Upstream bug assigned to paji Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26733 has been resolved. . Steps to retest:
1. ssh into your satellite box
2. run: foreman-rake console
3. In foreman-rake console, run the following: (we are manipulating duplicating bad data and then running migration)
a. #remove unique constraints since we are going to create duplicated data.
>ActiveRecord::Migration.remove_index :katello_contents, :name => :katello_contents_cpcid_orgid_uniq
>pc = Katello::ProdiuctContent.last
b. # create duplicated data
> content = pc.content.dup
> content.save!
> dup_pc = pc.dup
> dup_pc.content = content
> pc.save!
c. # run migration
> require '/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.2/db/migrate/20190205142619_add_content_constraints.rb'
> AddContentConstraints.new
> AddContentConstraints.new.up
Expected result:
Should be successful and does not return error.
Actual:
Is successful and there's no error:
=> #<AddContentConstraints:0x000000001274df08 @name="AddContentConstraints", @version=nil, @connection=nil>
irb(main):014:0> AddContentConstraints.new.up
-- change_column(:katello_product_contents, :content_id, :integer, {:null=>false})
-> 0.0239s
-- change_column(:katello_product_contents, :product_id, :integer, {:null=>false})
-> 0.0049s
-- add_index(:katello_contents, [:cp_content_id, :organization_id], {:unique=>true, :name=>:katello_contents_cpcid_orgid_uniq})
-> 0.0294s
=> #<PG::Result:0x00000000124e8218 status=PGRES_COMMAND_OK ntuples=0 nfields=0 cmd_tuples=0>
irb(main):015:0> require '/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.2/db/migrate/20190205142619_add_content_constraints.rb'
Verified on 6.9.0_09
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: Satellite 6.9 Release), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2021:1313 |