Sync problem between structure and dbrevs. For old prod databases only (that passed the 3.05 dbrevs) Note that I did not expect such a difference in a vital table like issues ! update $DBversion = "3.05.00.009"; $dbh->do("ALTER TABLE issues MODIFY COLUMN borrowernumber int(11) NOT NULL"); $dbh->do("ALTER TABLE issues MODIFY COLUMN itemnumber int(11) NOT NULL"); Current structure allows them to be NULL. I wonder if that is correct. An issue should have a borrower and an item, right?
Created attachment 133079 [details] [review] Bug 30483: Make issues.borrowernumber and itemnumber NOT NULL Note: This change does NOT apply to old_issues, where constraints may result in nullifying these columns. Test plan: Run dbrev. Try checkout, checkin.
Created attachment 133080 [details] [review] Bug 30483: DBIx changes for issues table Note: You may observe that DBIx drops the LEFT join_type here. There is no reason to be worried about that. If a FK column allows NULL values, DBIx sets it to LEFT. We remove the NULL here and DBIx now defaults to INNER again. No test plan. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 139195 [details] [review] Bug 30483: (DBIx schema) Changes to Issue.pm Compare with results of update_dbix_class_files.pl.
Note: You may observe that DBIx drops the LEFT join_type here. There is no reason to be worried about that. If a FK column allows NULL values, DBIx sets it to LEFT. We remove the NULL here and DBIx now defaults to INNER again.
Note from a discussion on IRC: We do not anonymize active issues. So no problem there. And if we mark an item as lost but not returned, the issue should still have an itemnumber and a borrowernumber. So no problem too.
Created attachment 139682 [details] [review] Bug 30483: Make issues.borrowernumber and itemnumber NOT NULL Note: This change does NOT apply to old_issues, where constraints may result in nullifying these columns. Test plan: Run dbrev. Try checkout, checkin. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 139683 [details] [review] Bug 30483: (DBIx schema) Changes to Issue.pm Compare with results of update_dbix_class_files.pl. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Makes sense to me.. Signing off
Created attachment 139924 [details] [review] Bug 30483: Make issues.borrowernumber and itemnumber NOT NULL Note: This change does NOT apply to old_issues, where constraints may result in nullifying these columns. Test plan: Run dbrev. Try checkout, checkin. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Created attachment 139925 [details] [review] Bug 30483: (DBIx schema) Changes to Issue.pm Compare with results of update_dbix_class_files.pl. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Pushed to master for 22.11. Nice work everyone, thanks!
Backported to 22.05.x for upcoming 22.05.07 release
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed. Nothing to document it seems, marking resolved.
Follow-up on bug 32399 to prevent failures.
Hi, I'm upgrading a Koha 21.05 in Debian 9.5 to Koha 22.05. After I do command line upgrade of koha-common, the intranet shows web install. Here, in tables structure update, the process stop with this message: Updating database structure Update errors : Upgrade to 22.05.06.001 [13:31:19]: Bug 30483 - Make issues.borrowernumber and itemnumber NOT NULL ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Cannot change column 'borrowernumber': used in a foreign key constraint 'issues_ibfk_1' at /usr/share/koha/lib/C4/Installer.pm line 739 Now, what can I do? Thks
(In reply to Pablo López Liotti from comment #15) > Hi, I'm upgrading a Koha 21.05 in Debian 9.5 to Koha 22.05. > > After I do command line upgrade of koha-common, the intranet shows web > install. > Here, in tables structure update, the process stop with this message: > > Updating database structure > Update errors : > > Upgrade to 22.05.06.001 [13:31:19]: Bug 30483 - Make issues.borrowernumber > and itemnumber NOT NULL > ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Cannot change > column 'borrowernumber': used in a foreign key constraint 'issues_ibfk_1' at > /usr/share/koha/lib/C4/Installer.pm line 739 > > Now, what can I do? > Thks See bug 32399. There is a fix. And it should have been pushed already to 22.05. But somehow it wasnt.