From f686ff9d427a84358a369a4555fbda84bc5254fe Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Oct 2020 16:17:42 +0200 Subject: [PATCH] Bug 13535: DBIC schema changes Signed-off-by: Jonathan Druart --- Koha/Schema/Result/Alert.pm | 29 ++++++++++++++++++++++++++--- Koha/Schema/Result/Borrower.pm | 19 +++++++++++++++++-- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Koha/Schema/Result/Alert.pm b/Koha/Schema/Result/Alert.pm index 2fae361efa..2db464d21b 100644 --- a/Koha/Schema/Result/Alert.pm +++ b/Koha/Schema/Result/Alert.pm @@ -33,6 +33,7 @@ __PACKAGE__->table("alert"); data_type: 'integer' default_value: 0 + is_foreign_key: 1 is_nullable: 0 =head2 type @@ -55,7 +56,12 @@ __PACKAGE__->add_columns( "alertid", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "borrowernumber", - { data_type => "integer", default_value => 0, is_nullable => 0 }, + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, "type", { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 }, "externalid", @@ -74,9 +80,26 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("alertid"); +=head1 RELATIONS -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:O4b7dlkDRkE6WLPKI5AO+A +=head2 borrowernumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrowernumber", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrowernumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-10-08 14:17:29 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jWeIEKGNHlVEBUGBuUXsug # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index a80a1b851a..8c2dcc20c6 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -722,6 +722,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 alerts + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "alerts", + "Koha::Schema::Result::Alert", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 api_keys Type: has_many @@ -1668,8 +1683,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-07-20 10:54:51 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pH5cKJCrjwfiLnk7iCO4tA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-10-08 14:17:29 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kzx7ildKCEFF6YDr6MRCrw __PACKAGE__->add_columns( '+anonymized' => { is_boolean => 1 }, -- 2.39.5