Bugzilla – Attachment 83462 Details for
Bug 22008
accountlines.manager_id is missing a foreign key constraint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22008: DBIC Schema Updates
Bug-22008-DBIC-Schema-Updates.patch (text/plain), 4.96 KB, created by
Martin Renvoize (ashimema)
on 2018-12-21 12:11:08 UTC
(
hide
)
Description:
Bug 22008: DBIC Schema Updates
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-12-21 12:11:08 UTC
Size:
4.96 KB
patch
obsolete
>From 16d18552b97d617024bbef9ebf48be5e8f467730 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 21 Dec 2018 12:10:02 +0000 >Subject: [PATCH] Bug 22008: DBIC Schema Updates > >--- > Koha/Schema/Result/Accountline.pm | 52 ++++++++++++++++++++++++++++--- > Koha/Schema/Result/Borrower.pm | 19 +++++++++-- > Koha/Schema/Result/Issue.pm | 19 +++++++++-- > 3 files changed, 81 insertions(+), 9 deletions(-) > >diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm >index 641b632ee7..ab8ca33254 100644 >--- a/Koha/Schema/Result/Accountline.pm >+++ b/Koha/Schema/Result/Accountline.pm >@@ -32,6 +32,7 @@ __PACKAGE__->table("accountlines"); > =head2 issue_id > > data_type: 'integer' >+ is_foreign_key: 1 > is_nullable: 1 > > =head2 borrowernumber >@@ -108,6 +109,7 @@ __PACKAGE__->table("accountlines"); > =head2 manager_id > > data_type: 'integer' >+ is_foreign_key: 1 > is_nullable: 1 > > =cut >@@ -116,7 +118,7 @@ __PACKAGE__->add_columns( > "accountlines_id", > { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, > "issue_id", >- { data_type => "integer", is_nullable => 1 }, >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, > "borrowernumber", > { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, > "accountno", >@@ -147,7 +149,7 @@ __PACKAGE__->add_columns( > "note", > { data_type => "mediumtext", is_nullable => 1 }, > "manager_id", >- { data_type => "integer", is_nullable => 1 }, >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, > ); > > =head1 PRIMARY KEY >@@ -214,6 +216,26 @@ __PACKAGE__->belongs_to( > }, > ); > >+=head2 issue >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Issue> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "issue", >+ "Koha::Schema::Result::Issue", >+ { issue_id => "issue_id" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "SET NULL", >+ on_update => "CASCADE", >+ }, >+); >+ > =head2 itemnumber > > Type: belongs_to >@@ -230,13 +252,33 @@ __PACKAGE__->belongs_to( > is_deferrable => 1, > join_type => "LEFT", > on_delete => "SET NULL", >- on_update => "SET NULL", >+ on_update => "CASCADE", >+ }, >+); >+ >+=head2 manager >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Borrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "manager", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "manager_id" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "SET NULL", >+ on_update => "CASCADE", > }, > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-12-19 16:19:16 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kvBIJshNRsm/HYJBbhm0IA >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-12-21 12:01:41 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oAlRy53c2P0qVSV27fJ+1Q > > sub koha_objects_class { > 'Koha::Account::Lines'; >diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm >index 8e4580f7e0..17daa7a457 100644 >--- a/Koha/Schema/Result/Borrower.pm >+++ b/Koha/Schema/Result/Borrower.pm >@@ -710,6 +710,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 accountlines_managers >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::Accountline> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "accountlines_managers", >+ "Koha::Schema::Result::Accountline", >+ { "foreign.manager_id" => "self.borrowernumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 api_keys > > Type: has_many >@@ -1431,8 +1446,8 @@ Composing rels: L</aqorder_users> -> ordernumber > __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-27 13:16:48 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:c3Tb59Kku0Hh+tsVV5eCDg >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-12-21 12:01:41 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cdZJs0uL23mwlAoicWvncQ > > __PACKAGE__->belongs_to( > "guarantor", >diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm >index e82886aae5..866292d165 100644 >--- a/Koha/Schema/Result/Issue.pm >+++ b/Koha/Schema/Result/Issue.pm >@@ -207,6 +207,21 @@ __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]); > > =head1 RELATIONS > >+=head2 accountlines >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::Accountline> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "accountlines", >+ "Koha::Schema::Result::Accountline", >+ { "foreign.issue_id" => "self.issue_id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 borrowernumber > > Type: belongs_to >@@ -248,8 +263,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-07-23 13:51:40 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+mlcId4odhAFp3HHgV/+tg >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-12-21 12:01:42 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OsRHKP1Qe5KuToNDALVW4Q > > __PACKAGE__->belongs_to( > "borrower", >-- >2.19.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22008
:
83278
|
83280
|
83460
|
83461
|
83462
|
85267
|
85268
|
85613
|
85614
|
85767
|
85768
|
86162
|
86163
|
86164
|
86659
|
86660
|
86661
|
86994
|
86995
|
87066
|
87072