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. Re: [Netdot-users] Netdot 1.0.6 release (Patrick M. Landry)
----------------------------------------------------------------------
Message: 1
Date: Thu, 17 Apr 2014 18:02:54 -0500 (CDT)
From: "Patrick M. Landry" <[email protected]>
Subject: Re: [Netdot-devel] [Netdot-users] Netdot 1.0.6 release
To: Netdot-users <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="utf-8"
I am upgrading from 1.0.4 running mysql. The "make install" generated the
following error:
# 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.
I believe this is because the device.bgplocalas field has not yet been
populated when trying to add the 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.
# 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`);";
--
patrick
Patrick Landry
University of Louisiana at Lafayette
Director, University Computer Support Services
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Landry, Patrick.vcf
Type: text/directory
Size: 11870 bytes
Desc: not available
Url :
http://osl.uoregon.edu/pipermail/netdot-devel/attachments/20140417/2daf57d3/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Landry, Patrick.vcf
Type: text/directory
Size: 11870 bytes
Desc: not available
Url :
http://osl.uoregon.edu/pipermail/netdot-devel/attachments/20140417/2daf57d3/attachment-0001.bin
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 85, Issue 12
********************************************