From 08d45ebd68f6cbc76878a485584abb252790ad16 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 27 Nov 2019 14:55:04 +0100 Subject: [PATCH] Bug 24151: Add new column borrower_attribute_types.keep_for_anonymized Sponsored-by: Association KohaLa - https://koha-fr.org/ --- Koha/Schema/Result/BorrowerAttributeType.pm | 4 ++++ installer/data/mysql/atomicupdate/bug_XXXXX.perl | 6 ++++++ installer/data/mysql/kohastructure.sql | 1 + 3 files changed, 11 insertions(+) diff --git a/Koha/Schema/Result/BorrowerAttributeType.pm b/Koha/Schema/Result/BorrowerAttributeType.pm index 46a86f07bc..e20f0dc5a1 100644 --- a/Koha/Schema/Result/BorrowerAttributeType.pm +++ b/Koha/Schema/Result/BorrowerAttributeType.pm @@ -165,6 +165,10 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-25 20:32:12 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gsPR8PuUUZHFUkr3MIbTpw +__PACKAGE__->add_columns( + '+keep_for_anonymized' => { is_boolean => 1 }, +); + sub koha_object_class { 'Koha::Patron::Attribute::Type'; } diff --git a/installer/data/mysql/atomicupdate/bug_XXXXX.perl b/installer/data/mysql/atomicupdate/bug_XXXXX.perl index bceb2883b3..b5cbd86529 100644 --- a/installer/data/mysql/atomicupdate/bug_XXXXX.perl +++ b/installer/data/mysql/atomicupdate/bug_XXXXX.perl @@ -71,6 +71,12 @@ if( CheckVersion( $DBversion ) ) { |); } + unless( column_exists('borrower_attribute_types', 'keep_for_anonymized') ) { + $dbh->do(q| + ALTER TABLE borrower_attribute_types ADD COLUMN `keep_for_anonymized` TINYINT(1) NOT NULL DEFAULT 0 AFTER `class` + |); + } + # Always end with this (adjust the bug info) SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index aa6718d3ba..207fbb083f 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -226,6 +226,7 @@ CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron field `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens `category_code` VARCHAR(10) NULL DEFAULT NULL,-- defines a category for an attribute_type `class` VARCHAR(255) NOT NULL DEFAULT '',-- defines a class for an attribute_type + `keep_for_anonymized` tinyint(1) NOT NULL default 0, -- defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no) PRIMARY KEY (`code`), KEY `auth_val_cat_idx` (`authorised_value_category`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.11.0