From 2ba9530964c33eafbf2ce82a8151b1dca29b3420 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Fri, 24 Mar 2017 13:28:50 -0300
Subject: [PATCH] Bug 17762: DBIC Schema changes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
---
 Koha/Schema/Result/Borrower.pm         | 18 ++++++++++--
 Koha/Schema/Result/Deletedborrower.pm  | 18 ++++++++++--
 Koha/Schema/Result/Letter.pm           | 41 +++++++++++++---------------
 Koha/Schema/Result/MessageTransport.pm | 50 ++++------------------------------
 4 files changed, 56 insertions(+), 71 deletions(-)

diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm
index 26cdef9..6d3e3a5 100644
--- a/Koha/Schema/Result/Borrower.pm
+++ b/Koha/Schema/Result/Borrower.pm
@@ -427,6 +427,13 @@ __PACKAGE__->table("borrowers");
   datetime_undef_if_invalid: 1
   is_nullable: 1
 
+=head2 lang
+
+  data_type: 'varchar'
+  default_value: 'default'
+  is_nullable: 0
+  size: 25
+
 =head2 overdrive_auth_token
 
   data_type: 'text'
@@ -621,6 +628,13 @@ __PACKAGE__->add_columns(
     datetime_undef_if_invalid => 1,
     is_nullable => 1,
   },
+  "lang",
+  {
+    data_type => "varchar",
+    default_value => "default",
+    is_nullable => 0,
+    size => 25,
+  },
   "overdrive_auth_token",
   { data_type => "text", is_nullable => 1 },
 );
@@ -1356,8 +1370,8 @@ Composing rels: L</aqorder_users> -> ordernumber
 __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber");
 
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-04-26 16:17:25
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Qq3fmJ73x8Qv+Pqbs7zkow
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-23 21:42:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dchVNO0KEo638glUkcMLkg
 
 __PACKAGE__->belongs_to(
     "guarantor",
diff --git a/Koha/Schema/Result/Deletedborrower.pm b/Koha/Schema/Result/Deletedborrower.pm
index 778705e..c319a1f 100644
--- a/Koha/Schema/Result/Deletedborrower.pm
+++ b/Koha/Schema/Result/Deletedborrower.pm
@@ -424,6 +424,13 @@ __PACKAGE__->table("deletedborrowers");
   datetime_undef_if_invalid: 1
   is_nullable: 1
 
+=head2 lang
+
+  data_type: 'varchar'
+  default_value: 'default'
+  is_nullable: 0
+  size: 25
+
 =head2 overdrive_auth_token
 
   data_type: 'text'
@@ -606,13 +613,20 @@ __PACKAGE__->add_columns(
     datetime_undef_if_invalid => 1,
     is_nullable => 1,
   },
+  "lang",
+  {
+    data_type => "varchar",
+    default_value => "default",
+    is_nullable => 0,
+    size => 25,
+  },
   "overdrive_auth_token",
   { data_type => "text", is_nullable => 1 },
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-02-10 07:30:06
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tq4JDUSFKuU5K69TTVSkVg
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-23 21:29:33
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sqSjOzPoHG6b9TNRE669DA
 
 
 # You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/Koha/Schema/Result/Letter.pm b/Koha/Schema/Result/Letter.pm
index 04261e2..2e19aab 100644
--- a/Koha/Schema/Result/Letter.pm
+++ b/Koha/Schema/Result/Letter.pm
@@ -77,6 +77,13 @@ __PACKAGE__->table("letter");
   is_nullable: 0
   size: 20
 
+=head2 lang
+
+  data_type: 'varchar'
+  default_value: 'default'
+  is_nullable: 0
+  size: 25
+
 =cut
 
 __PACKAGE__->add_columns(
@@ -102,6 +109,13 @@ __PACKAGE__->add_columns(
     is_nullable => 0,
     size => 20,
   },
+  "lang",
+  {
+    data_type => "varchar",
+    default_value => "default",
+    is_nullable => 0,
+    size => 25,
+  },
 );
 
 =head1 PRIMARY KEY
@@ -116,11 +130,13 @@ __PACKAGE__->add_columns(
 
 =item * L</message_transport_type>
 
+=item * L</lang>
+
 =back
 
 =cut
 
-__PACKAGE__->set_primary_key("module", "code", "branchcode", "message_transport_type");
+__PACKAGE__->set_primary_key("module", "code", "branchcode", "message_transport_type", "lang");
 
 =head1 RELATIONS
 
@@ -139,28 +155,9 @@ __PACKAGE__->belongs_to(
   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
 );
 
-=head2 message_transports
-
-Type: has_many
-
-Related object: L<Koha::Schema::Result::MessageTransport>
-
-=cut
-
-__PACKAGE__->has_many(
-  "message_transports",
-  "Koha::Schema::Result::MessageTransport",
-  {
-    "foreign.branchcode"    => "self.branchcode",
-    "foreign.letter_code"   => "self.code",
-    "foreign.letter_module" => "self.module",
-  },
-  { cascade_copy => 0, cascade_delete => 0 },
-);
-
 
-# Created by DBIx::Class::Schema::Loader v0.07025 @ 2014-05-02 18:04:32
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HFUQ+/BKlweHglzOlm0lUQ
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-23 21:29:34
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:A9wpcu1LVyagxvkrqJMpLw
 
 
 # You can replace this text with custom content, and it will be preserved on regeneration
diff --git a/Koha/Schema/Result/MessageTransport.pm b/Koha/Schema/Result/MessageTransport.pm
index 3a2f9a9..7d3373a 100644
--- a/Koha/Schema/Result/MessageTransport.pm
+++ b/Koha/Schema/Result/MessageTransport.pm
@@ -46,7 +46,6 @@ __PACKAGE__->table("message_transports");
 
   data_type: 'varchar'
   default_value: (empty string)
-  is_foreign_key: 1
   is_nullable: 0
   size: 20
 
@@ -54,7 +53,6 @@ __PACKAGE__->table("message_transports");
 
   data_type: 'varchar'
   default_value: (empty string)
-  is_foreign_key: 1
   is_nullable: 0
   size: 20
 
@@ -62,7 +60,6 @@ __PACKAGE__->table("message_transports");
 
   data_type: 'varchar'
   default_value: (empty string)
-  is_foreign_key: 1
   is_nullable: 0
   size: 10
 
@@ -76,29 +73,11 @@ __PACKAGE__->add_columns(
   "is_digest",
   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
   "letter_module",
-  {
-    data_type => "varchar",
-    default_value => "",
-    is_foreign_key => 1,
-    is_nullable => 0,
-    size => 20,
-  },
+  { data_type => "varchar", default_value => "", is_nullable => 0, size => 20 },
   "letter_code",
-  {
-    data_type => "varchar",
-    default_value => "",
-    is_foreign_key => 1,
-    is_nullable => 0,
-    size => 20,
-  },
+  { data_type => "varchar", default_value => "", is_nullable => 0, size => 20 },
   "branchcode",
-  {
-    data_type => "varchar",
-    default_value => "",
-    is_foreign_key => 1,
-    is_nullable => 0,
-    size => 10,
-  },
+  { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
 );
 
 =head1 PRIMARY KEY
@@ -119,25 +98,6 @@ __PACKAGE__->set_primary_key("message_attribute_id", "message_transport_type", "
 
 =head1 RELATIONS
 
-=head2 letter
-
-Type: belongs_to
-
-Related object: L<Koha::Schema::Result::Letter>
-
-=cut
-
-__PACKAGE__->belongs_to(
-  "letter",
-  "Koha::Schema::Result::Letter",
-  {
-    branchcode => "branchcode",
-    code => "letter_code",
-    module => "letter_module",
-  },
-  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
-);
-
 =head2 message_attribute
 
 Type: belongs_to
@@ -169,8 +129,8 @@ __PACKAGE__->belongs_to(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:P4Bsq0A7/imUhRBRnD5HrQ
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-23 21:42:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RYvCEp0euH7L07OBlttqPw
 
 
 # You can replace this text with custom content, and it will be preserved on regeneration
-- 
2.1.4