From 56a06ec159906da8e709360c945b7ef2ef43ddcb Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Fri, 11 Mar 2022 14:05:48 +0000
Subject: [PATCH] Bug 30275: Add 'renewals' relation to Issue Schema

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
 Koha/Schema/Result/Issue.pm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm
index 0ab760fad4..44debc944b 100644
--- a/Koha/Schema/Result/Issue.pm
+++ b/Koha/Schema/Result/Issue.pm
@@ -373,6 +373,21 @@ __PACKAGE__->belongs_to(
   },
 );
 
+=head2 renewals
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::CheckoutRenewal>
+
+=cut
+
+__PACKAGE__->has_many(
+    "renewals",
+    "Koha::Schema::Result::CheckoutRenewal",
+    { "foreign.issue_id" => "self.issue_id" },
+    { cascade_copy       => 0, cascade_delete => 0 },
+);
+
 =head2 return_claim
 
 Type: might_have
-- 
2.20.1