[racktables-users] Re: Error during upgrade.

  • From: Denis Ovsienko <pilot@xxxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Fri, 18 Sep 2009 18:09:38 +0400

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);

-- 
    Denis Ovsienko

Other related posts: