[Koha] upgrade error running koha-upgrade-schema

Paulo Neto pneto at dgadr.pt
Tue Jun 6 21:20:40 NZST 2023


Hello all,

I've been trying to upgrade my koha 18.11 to version 22.11.

When i run the comand koha-upgrade-schema to upgrade the database schema i am getting this error:

" UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Can't create table `koha_dgadr`.`illrequests` (errno: 150 "Foreign key constraint is incorrectly formed")  at /usr/share/perl5/DBIx/Class/Schema.pm line 1118 "

This is happening on 18.12.00.016 step list in da script updatedatabase.pl (line17406) Corresponding to this line of code, in my case the  illrequests_safk doesnt existe before running the script:

if ( !foreign_key_exists( 'illrequests', 'illrequests_safk' ) ) {
        $dbh->do( "ALTER TABLE illrequests ADD CONSTRAINT illrequests_safk FOREIGN KEY (status_alias) REFERENCES authorised_values(authorised_value) ON UPDATE CASCADE ON DELETE SET NULL" );
    }

I do have some equal values for the column authorised_value on the table authorised_value and i think its probably the reason it cant create the foreign key on the table illrequests,

Is there a way to correct this?

Yours sincerely,

Paulo Neto


More information about the Koha mailing list