Bug 30483 - Should issues.borrowernumber and issues.itemnumber be NOT NULL ?
Summary: Should issues.borrowernumber and issues.itemnumber be NOT NULL ?
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Database (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 30486
  Show dependency treegraph
 
Reported: 2022-04-07 09:43 UTC by Marcel de Rooy
Modified: 2022-04-07 13:06 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 30483: Make issues.borrowernumber and itemnumber NOT NULL (2.91 KB, patch)
2022-04-07 13:06 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 30483: DBIx changes for issues table (2.96 KB, patch)
2022-04-07 13:06 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2022-04-07 09:43:58 UTC
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?
Comment 1 Marcel de Rooy 2022-04-07 13:06:25 UTC
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.
Comment 2 Marcel de Rooy 2022-04-07 13:06:28 UTC
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>