From 1bb476b03f5773eec9a10abd9a9cb5dffffbaee2 Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Wed, 30 Oct 2024 18:58:53 +0000 Subject: [PATCH] Bug 32773: schema update [DO NOT PUSH] --- Koha/Schema/Result/BiblioFramework.pm | 32 +++++++++++++------ .../data/mysql/atomicupdate/bug_32773.pl | 15 +++++---- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Koha/Schema/Result/BiblioFramework.pm b/Koha/Schema/Result/BiblioFramework.pm index 15755315d2..60075d8fb9 100644 --- a/Koha/Schema/Result/BiblioFramework.pm +++ b/Koha/Schema/Result/BiblioFramework.pm @@ -1,4 +1,5 @@ use utf8; + package Koha::Schema::Result::BiblioFramework; # Created by DBIx::Class::Schema::Loader @@ -41,13 +42,23 @@ the unique code assigned to the framework the description/name given to the framework +=head2 is_fast_add + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +the ability to be used as a Fast Add framework + =cut __PACKAGE__->add_columns( - "frameworkcode", - { data_type => "varchar", default_value => "", is_nullable => 0, size => 4 }, - "frameworktext", - { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, + "frameworkcode", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 4 }, + "frameworktext", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, + "is_fast_add", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -62,9 +73,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("frameworkcode"); - -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YdCNaeY5v1WcfcDuA6xE0w +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-10-30 18:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GTnC4ZNUn+hFvXTjubfBXg # FIXME This should not be needed, we need to add the FK at DB level # It cannot be done now because the default framework (frameworkcode=='') @@ -72,8 +82,12 @@ __PACKAGE__->set_primary_key("frameworkcode"); __PACKAGE__->has_many( "marc_tag_structure", "Koha::Schema::Result::MarcTagStructure", - { "foreign.frameworkcode" => "self.frameworkcode"}, - { cascade_copy => 0, cascade_delete => 0 }, + { "foreign.frameworkcode" => "self.frameworkcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +__PACKAGE__->add_columns( + '+is_fast_add' => { is_boolean => 1 }, ); # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/bug_32773.pl b/installer/data/mysql/atomicupdate/bug_32773.pl index c2752ef832..eea1631b15 100755 --- a/installer/data/mysql/atomicupdate/bug_32773.pl +++ b/installer/data/mysql/atomicupdate/bug_32773.pl @@ -9,17 +9,20 @@ return { my ( $dbh, $out ) = @$args{qw(dbh out)}; try { - $dbh->do(q{ + $dbh->do( + q{ ALTER TABLE biblio_framework ADD COLUMN is_fast_add TINYINT(1) NOT NULL DEFAULT 0 AFTER frameworktext; - }); + } + ); say $out "Added column 'biblio_framework.is_fast_add'"; - $dbh->do(q{ + $dbh->do( + q{ UPDATE biblio_framework SET is_fast_add = 1 where frameworkcode = 'FA'; - }); - } - catch { + } + ); + } catch { say_failure( $out, "Database modification failed with errors: $_" ); }; }, -- 2.39.5