From aa3a0d876f14b419b940097fdba2cfa70f0a4d4e Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 2 Sep 2022 06:17:28 +0000 Subject: [PATCH] Bug 31503: Adjust db column patron_consent.type We want to control this field now via authorised values. An ENUM is too restrictive. A foreign key on the values of authorised_value for category 'PATRON_CONSENT' is not possible. This will do for now. Test plan: Run dbrev. Signed-off-by: Marcel de Rooy Signed-off-by: David Nind --- installer/data/mysql/atomicupdate/bug_31503.pl | 16 ++++++++++++++++ installer/data/mysql/mandatory/auth_val_cat.sql | 1 + 2 files changed, 17 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_31503.pl diff --git a/installer/data/mysql/atomicupdate/bug_31503.pl b/installer/data/mysql/atomicupdate/bug_31503.pl new file mode 100755 index 0000000000..8552bd37e2 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_31503.pl @@ -0,0 +1,16 @@ +use Modern::Perl; + +return { + bug_number => 31503, + description => "Adjust patron_consent.type and add AV category", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{ +ALTER TABLE patron_consent CHANGE COLUMN `type` `type` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron consent type; controlled by authorised values'; + }); + $dbh->do(q{ +INSERT IGNORE INTO authorised_value_categories (category_name) VALUES ('PATRON_CONSENT'); + }); + }, +}; diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index aef65fb807..e2ec9d590d 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -19,6 +19,7 @@ INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) ('PA_CLASS', 0), ('HOLD_CANCELLATION', 0), ('ROADTYPE', 0), + ('PATRON_CONSENT', 0), ('AR_CANCELLATION', 0); INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) -- 2.30.2