upgrade error running koha-upgrade-schema
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
Hi Paulo, You have values in illrequests.illrequests_safk that are not defined in the authorised_values values. Regards, Jonathan Le mar. 6 juin 2023 à 11:20, Paulo Neto <pneto@dgadr.pt> a écrit :
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 _______________________________________________
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
participants (2)
-
Jonathan Druart -
Paulo Neto