[racktables-users] Re: Error during upgrade.

  • From: Craig West <cwest@xxxxxxxxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Mon, 21 Sep 2009 09:51:36 -0400


Denis,

Thanks for the quick reply. I only had 3 bad records and the two SQL commands you listed below worked fine.

Craig.

On 09/18/2009 10:09 AM, Denis Ovsienko wrote:
On Fri, 18 Sep 2009 09:13:24 -0400 Craig West wrote:

I got this error during an upgrade to 0.17.5

Executing batch '0.17.4'*
The following queries failed:*

ALTER TABLE Port ADD CONSTRAINT `Port-FK-object_id` FOREIGN KEY (object_id) 
REFERENCES RackObject (id) -- Cannot add or update a child row: a foreign key 
constraint fails (`racktables/#sql-a76_b850`, CONSTRAINT `Port-FK-object_id` 
FOREIGN KEY (`object_id`) REFERENCES `RackObject` (`id`))


Should I be worried? What do I need to do to correct it?

These are some lost port records, which belong to non-existent
object(s). This shouldn't normally happen, but after all it's not
critical. Could you try these quieries after making a backup dump?

DELETE FROM Port WHERE object_id NOT IN (SELECT id FROM RackObject);

ALTER TABLE Port ADD CONSTRAINT `Port-FK-object_id`
FOREIGN KEY (object_id) REFERENCES RackObject (id);

Other related posts: