https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30899
--- Comment #7 from Magnus Enger <[email protected]> --- The relevant code in the database update is: if( foreign_key_exists('borrower_attribute_types', 'category_code_fk') ) { $dbh->do( q|ALTER TABLE borrower_attribute_types DROP CONSTRAINT category_code_fk| ); ... } The database that succeeds had this before the upgrade: PRIMARY KEY (`code`), KEY `auth_val_cat_idx` (`authorised_value_category`), KEY `category_code_fk` (`category_code`), CONSTRAINT `category_code_fk` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`) And the one that fails had: PRIMARY KEY (`code`), KEY `auth_val_cat_idx` (`authorised_value_category`) C4::Installer::foreign_key_exists looks like this 648 sub foreign_key_exists { 649 my ( $table_name, $constraint_name ) = @_; 650 my $dbh = C4::Context->dbh; 651 my (undef, $infos) = $dbh->selectrow_array(qq|SHOW CREATE TABLE $table_name|); 652 return $infos =~ m|CONSTRAINT `$constraint_name` FOREIGN KEY|; 653 } Looks to me like the "if" above should prevent the "ALTER TABLE borrower_attribute_types DROP CONSTRAINT category_code_fk" from being run against the database at all? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
