Bug 42046

Summary: Bug 30331 database update is not idempotent
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: Architecture, internals, and plumbingAssignee: Lucas Gass (lukeg) <lucas>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 30331    
Bug Blocks:    
Attachments: Bug 42046: Make DR Rev 25.12.00.18 more resilient

Description Lucas Gass (lukeg) 2026-03-09 21:05:36 UTC
The DBRev for Bug 30331 is not idempotent:

my $base_period = C4::Context->preference('RenewalPeriodBase');

$dbh->do(
    q{
        UPDATE systempreferences SET variable = 'ManualRenewalPeriodBase' WHERE variable = 'RenewalPeriodBase'
    }
);


When ran twice:

"ERROR: {UNKNOWN}: DBI Exception: DBD:
:db do failed: Duplicate entry 'ManualRenewalPeriodBase' for key 'PRIMARY' at /kohadevbox/koha/C4/Installer.pm line 819"
Comment 1 Lucas Gass (lukeg) 2026-03-09 21:09:20 UTC
Created attachment 195031 [details] [review]
Bug 42046: Make DR Rev 25.12.00.18 more resilient