From e95a0e8df3e188c0e4c24cae1c500bde47370e61 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 24 Feb 2026 10:12:08 +0000 Subject: [PATCH] Bug 33538: Database updates adding sync options for identity providers Adds database update and kohastructure change to include sync_on_creation and sync_on_update fields to the identity_provider_mappings table. Test plan: 1. Apply the atomic update 2. Verify new fields exist in the identity_provider_mappings table Sponsored-by: ByWater Solutions --- .../data/mysql/atomicupdate/bug_33538.pl | 32 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 34 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_33538.pl diff --git a/installer/data/mysql/atomicupdate/bug_33538.pl b/installer/data/mysql/atomicupdate/bug_33538.pl new file mode 100644 index 00000000000..60395318f6b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33538.pl @@ -0,0 +1,32 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "33538", + description => "Add sync_on_creation and sync_on_update to identity_provider_mappings", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + unless ( column_exists( 'identity_providers_mappings', 'sync_on_creation' ) ) { + $dbh->do( + q{ + ALTER TABLE identity_provider_mappings + ADD COLUMN sync_on_creation TINYINT(1) NOT NULL DEFAULT 1 AFTER default_content + } + ); + say_success( $out, "Added sync_on_creation to identity_provider_mappings table" ); + } + + unless ( column_exists( 'identity_providers_mappings', 'sync_on_update' ) ) { + $dbh->do( + q{ + ALTER TABLE identity_provider_mappings + ADD COLUMN sync_on_update TINYINT(1) NOT NULL DEFAULT 1 AFTER sync_on_creation + } + ); + say_success( $out, "Added sync_on_update columns to identity_provider_mappings table" ); + } + + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 2421df3d95c..d24dbdb8e03 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3724,6 +3724,8 @@ CREATE TABLE `identity_provider_mappings` ( `provider_field` varchar(255) DEFAULT NULL COMMENT 'Attribute name from the identity provider', `koha_field` varchar(255) NOT NULL COMMENT 'Corresponding field in Koha borrowers table', `default_content` varchar(255) DEFAULT NULL COMMENT 'Default value if provider does not supply this field', + `sync_on_creation` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'Whether to sync this field on user creation', + `sync_on_update` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'Whether to sync this field on user update', PRIMARY KEY (`mapping_id`), UNIQUE KEY `provider_koha_field` (`identity_provider_id`,`koha_field`), KEY `provider_field_idx` (`provider_field`), -- 2.53.0