Send Netdot-devel mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."
Today's Topics:
1. [Netdot - Bug #1801] (New) 1.0.6 upgrade script error
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Mon, 21 Apr 2014 14:26:36 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1801] (New) 1.0.6 upgrade
script error
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1801 has been reported by Patrick Landry.
----------------------------------------
Bug #1801: 1.0.6 upgrade script error
https://osl.uoregon.edu/redmine/issues/1801
Author: Patrick Landry
Status: New
Priority: Normal
Assignee:
Category:
Target version:
Resolution:
When running "make upgrade" on a 1.0.4 MySQL system I received the following
error:
<pre>
# cat upgrade/error.log
DBD::mysql::db do failed: Cannot add or update a child row: a foreign key
constraint fails (`netdot`.<result 2 when explaining filename '#sql-758_2'>,
CONSTRAINT `fk_bgplocalas` FOREIGN KEY (`bgplocalas`) REFERENCES `asn` (`id`))
at ../lib/DBUTIL.pm line 592.
ERROR while executing ALTER TABLE device ADD CONSTRAINT `fk_bgplocalas` FOREIGN
KEY (`bgplocalas`) REFERENCES `asn` (`id`): DBD::mysql::db do failed: Cannot
add or update a child row: a foreign key constraint fails (`netdot`.<result 2
when explaining filename '#sql-758_2'>, CONSTRAINT `fk_bgplocalas` FOREIGN KEY
(`bgplocalas`) REFERENCES `asn` (`id`)) at ../lib/DBUTIL.pm line 592.
</pre>
I believe this is because the device.bgplocalas field has not yet been
populated when trying to add the fk_bgplocalas foreign key contraint to the
device table generating the foreign key error.
The fix was to move the creation of the device.fk_bgplocalas key after the
update statement which populates the device.bgplocalas field.
<pre>
# diff -C 3 updatedb /var/tmp/updatedb
*** updatedb 2014-04-11 08:38:28.000000000 -0500
--- /var/tmp/updatedb 2014-04-17 17:41:47.071631814 -0500
***************
*** 208,219 ****
push @statements, "INSERT INTO asn (number) SELECT DISTINCT
bgplocalas FROM device WHERE bgplocalas IS NOT NULL;";
push @statements, "ALTER TABLE device MODIFY bgplocalas bigint;";
- push @statements, "ALTER TABLE device ADD CONSTRAINT `fk_bgplocalas`
FOREIGN KEY (`bgplocalas`) ".
- "REFERENCES `asn` (`id`);";
push @statements, "CREATE INDEX bgplocalas ON device (bgplocalas);";
push @statements, "UPDATE device,asn SET device.bgplocalas=asn.id
WHERE device.bgplocalas=asn.number;";
push @statements, "ALTER TABLE bgppeering ADD COLUMN contactlist
bigint;";
push @statements, "ALTER TABLE bgppeering ADD CONSTRAINT
`fk_contactlist_bgppeering` FOREIGN KEY (`contactlist`) ".
"REFERENCES `contactlist` (`id`);";
--- 208,220 ----
push @statements, "INSERT INTO asn (number) SELECT DISTINCT
bgplocalas FROM device WHERE bgplocalas IS NOT NULL;";
push @statements, "ALTER TABLE device MODIFY bgplocalas bigint;";
push @statements, "CREATE INDEX bgplocalas ON device (bgplocalas);";
push @statements, "UPDATE device,asn SET device.bgplocalas=asn.id
WHERE device.bgplocalas=asn.number;";
+ push @statements, "ALTER TABLE device ADD CONSTRAINT `fk_bgplocalas`
FOREIGN KEY (`bgplocalas`) ".
+ "REFERENCES `asn` (`id`);";
+
push @statements, "ALTER TABLE bgppeering ADD COLUMN contactlist
bigint;";
push @statements, "ALTER TABLE bgppeering ADD CONSTRAINT
`fk_contactlist_bgppeering` FOREIGN KEY (`contactlist`) ".
"REFERENCES `contactlist` (`id`);";
</pre>
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://osl.uoregon.edu/redmine/my/account
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 85, Issue 13
********************************************