Koha-clms/installer/data/mysql/mandatory
Martin Renvoize b55535e770
Bug 34000: Add autoMemberNumValue system preference
Introduces a new system preference, autoMemberNumValue, which tracks
the highest auto-generated cardnumber ever issued. It is seeded from
the MAX cardnumber across both borrowers and deletedborrowers so
pre-upgrade deletions do not free numbers for re-issuance.

This preference is managed internally by Koha::Patron::fixup_cardnumber
and has no UI (no YAML entry).

Test plan:
1. Apply the atomicupdate:
   perl installer/data/mysql/updatedatabase.pl
2. Verify the preference exists:
   SELECT * FROM systempreferences WHERE variable = 'autoMemberNumValue';
3. Confirm the seed value matches:
   SELECT GREATEST(
       COALESCE((SELECT MAX(CAST(cardnumber AS SIGNED)) FROM borrowers
                 WHERE cardnumber REGEXP '^-?[0-9]+\$'), 0),
       COALESCE((SELECT MAX(CAST(cardnumber AS SIGNED)) FROM deletedborrowers
                 WHERE cardnumber REGEXP '^-?[0-9]+\$'), 0)
   );
4. Re-run the atomicupdate and confirm the already-exists warning.
5. Drop the syspref, re-apply the atomicupdate, confirm it seeds
   correctly on fresh installs via mandatory/sysprefs.sql.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
(cherry picked from commit aa84e99db8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-28 15:57:04 -06:00
..
audio_alerts.sql
…
auth_val_cat.sql Bug 38222: (QA follow-up) Add av category update 2024-10-25 16:41:35 +02:00
keyboard_shortcuts.sql Bug 40163: (follow-up) Fix wrong GNU links and update test 2026-01-07 14:32:37 +00:00
message_transport_types.sql
…
sample_notices_message_attributes.sql Bug 30300: Add a patron expiry messaging preference 2025-02-03 14:26:53 +01:00
sample_notices_message_transports.sql Bug 30300: Add a patron expiry messaging preference 2025-02-03 14:26:53 +01:00
subtag_registry.sql Bug 39147: Add more missing languages 2025-04-23 09:35:18 +02:00
sysprefs.sql Bug 34000: Add autoMemberNumValue system preference 2026-04-28 15:57:04 -06:00
userflags.sql Bug 30708: DB changes 2023-10-18 15:41:41 -03:00
userpermissions.sql Bug 35830: Add merge_borrowers subpermission 2025-11-25 17:36:10 +01:00