Jayad / enterprise-log-search-and-archive

Automatically exported from code.google.com/p/enterprise-log-search-and-archive
0 stars 0 forks source link

During update, foreign key constraint fails #137

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Updating ELSA

What is the expected output? What do you see instead?
Updating MySQL...
ERROR 1452 (23000) at line 1: Cannot add or update a child row: a foreign key 
constraint fails (`syslog`.`fields_classes_map`, CONSTRAINT 
`fields_classes_map_ibfk_1` FOREIGN KEY (`field_id`) REFERENCES `fields` (`id`) 
ON DELETE CASCADE ON UPDATE CASCADE)

What version of the product are you using? On what operating system?
r867 on Ubuntu 12.04

Please provide any additional information below.
Appears as though this line from the new schema.sql is not getting inserted 
into the fields table:
INSERT INTO fields (field, field_type, pattern_type, input_validation) VALUES 
("srcip_nat", "int", "IPv4", "IPv4");

Original issue reported on code.google.com by kebut...@gmail.com on 9 May 2013 at 1:19

GoogleCodeExporter commented 9 years ago
Looks like the following is missing from update_node_mysql() in the install.sh 
script:
mysql -u$MYSQL_ROOT_USER $MYSQL_PASS_SWITCH $MYSQL_NODE_DB -e 'INSERT IGNORE 
INTO fields (field, field_type, pattern_type, input_validation) VALUES 
("srcip_nat", "int", "IPv4", "IPv4")'

I manually ran the following command at the mysql command prompt, which I got 
from the latest schema.sql:
INSERT INTO fields (field, field_type, pattern_type, input_validation) VALUES 
("srcip_nat", "int", "IPv4", "IPv4");

Re-ran elsa updates and all is good.  Same problem as the 'line_number' issue 
from a few days ago.

Original comment by kebut...@gmail.com on 9 May 2013 at 3:42

GoogleCodeExporter commented 9 years ago
Fixed in 877

Original comment by mchol...@gmail.com on 10 May 2013 at 8:03