Project

General

Profile

Actions

Bug #18202

closed

Candlepin tables are missing primary key

Added by Karlis Melderis over 7 years ago. Updated almost 6 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I found that set of candlepin tables don't have primary key thus I cannot move DB to Postgress BDR (updates and deletes are denied)

Here are keys I added

\d+ cp_consumer_content_tags
ALTER TABLE cp_consumer_content_tags ADD PRIMARY KEY (consumer_id, content_tag);
\d+ cp_content_modified_products;
ALTER TABLE cp_content_modified_products ADD PRIMARY KEY (cp_content_id, element);
\d+ cp_pool_branding
ALTER TABLE cp_pool_branding ADD PRIMARY KEY (pool_id, branding_id);
\d+ cp_product_dependent_products
ALTER TABLE cp_product_dependent_products ADD PRIMARY KEY (cp_product_id, element);
\d+ cp_sub_branding
ALTER TABLE cp_sub_branding ADD PRIMARY KEY (subscription_id, branding_id);
\d+ cp_sub_derivedprods
ALTER TABLE cp_sub_derivedprods ADD PRIMARY KEY (subscription_id, product_id);
\d+ databasechangelog
ALTER TABLE databasechangelog ADD PRIMARY KEY (id);

Actions #1

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release deleted (213)
Actions #2

Updated by Justin Sherrill about 7 years ago

  • Status changed from New to Rejected
  • translation missing: en.field_release set to 166

I chatted with the candlepin team and this is what they said:

First and foremost, while adding a primary key is preferred on paper, I seem to recall Hibernate doing silly
things like adding a duplicate row and then deleting the old one when doing some updates or some such.

Having a primary key or unique constraint may cause some headaches.
The databasechangelog table is something managed by liquibase, so I'd be reluctant to mess with that at all,
but it's likely more safe/sane than the ones Hibernate fiddles with.

And, finally, cp_product_dependent_products, cp_sub_branding and cp_sub_derivedprods no longer exist in cp2.
cp_product_dependent_products is cp2_product_dependent_products and has the same missing-primary-key issue.

I would suggest filing this issue over at candlepin's bugzilla: https://bugzilla.redhat.com/enter_bug.cgi?product=Candlepin

I'm gonna go ahead and close this as there isn't anything katello can do sadly :(

Actions

Also available in: Atom PDF