From a0c76a2a5fb47d4f21ed569452574efe6c688fd1 Mon Sep 17 00:00:00 2001
From: Mark Tompsett <mtompset@hotmail.com>
Date: Wed, 21 Oct 2015 19:55:08 -0400
Subject: [PATCH] Bug 14246: Adding Koha::Schema::Result differences

Ran misc/devel/update_dbix_class_files.pl as shown on
wiki/Database_updates#updatedatabase.pl
However, only git added Borrower and Opacnews, since
those were the two affected by this patch.
---
 Koha/Schema/Result/Borrower.pm | 19 +++++++++++++++++--
 Koha/Schema/Result/OpacNews.pm | 32 ++++++++++++++++++++++++++++++--
 2 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm
index da4e94c..1a7673e 100644
--- a/Koha/Schema/Result/Borrower.pm
+++ b/Koha/Schema/Result/Borrower.pm
@@ -902,6 +902,21 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
+=head2 opac_news
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::OpacNews>
+
+=cut
+
+__PACKAGE__->has_many(
+  "opac_news",
+  "Koha::Schema::Result::OpacNews",
+  { "foreign.borrowernumber" => "self.borrowernumber" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
 =head2 patron_list_patrons
 
 Type: has_many
@@ -1138,8 +1153,8 @@ Composing rels: L</aqorder_users> -> ordernumber
 __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber");
 
 
-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2015-10-06 10:38:42
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AdaMeazHWWCtMM7rvKX9Lg
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-10-21 19:50:05
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QafovaRBnm36nyoyQTGIgQ
 
 
 # You can replace this text with custom content, and it will be preserved on regeneration
diff --git a/Koha/Schema/Result/OpacNews.pm b/Koha/Schema/Result/OpacNews.pm
index 8a42467..2a4b80b 100644
--- a/Koha/Schema/Result/OpacNews.pm
+++ b/Koha/Schema/Result/OpacNews.pm
@@ -75,6 +75,12 @@ __PACKAGE__->table("opac_news");
   data_type: 'integer'
   is_nullable: 1
 
+=head2 borrowernumber
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 1
+
 =cut
 
 __PACKAGE__->add_columns(
@@ -104,6 +110,8 @@ __PACKAGE__->add_columns(
   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
   "number",
   { data_type => "integer", is_nullable => 1 },
+  "borrowernumber",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
 );
 
 =head1 PRIMARY KEY
@@ -120,6 +128,26 @@ __PACKAGE__->set_primary_key("idnew");
 
 =head1 RELATIONS
 
+=head2 borrowernumber
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Borrower>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "borrowernumber",
+  "Koha::Schema::Result::Borrower",
+  { borrowernumber => "borrowernumber" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "SET NULL",
+    on_update     => "CASCADE",
+  },
+);
+
 =head2 branchcode
 
 Type: belongs_to
@@ -141,8 +169,8 @@ __PACKAGE__->belongs_to(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07025 @ 2014-02-16 23:15:22
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/q+riAqsYmCQkUCUL9MU7g
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-10-21 19:50:05
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QivH1Daozdp0BttbPF6CkA
 
 
 # You can replace this text with custom content, and it will be preserved on regeneration
-- 
2.1.4