Bug 23049: (follow-up) Types should not be deletable
[koha.git] / Koha / Schema / Result / BorrowerRelationship.pm
1 use utf8;
2 package Koha::Schema::Result::BorrowerRelationship;
3
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7 =head1 NAME
8
9 Koha::Schema::Result::BorrowerRelationship
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<borrower_relationships>
19
20 =cut
21
22 __PACKAGE__->table("borrower_relationships");
23
24 =head1 ACCESSORS
25
26 =head2 id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 guarantor_id
33
34   data_type: 'integer'
35   is_foreign_key: 1
36   is_nullable: 1
37
38 =head2 guarantee_id
39
40   data_type: 'integer'
41   is_foreign_key: 1
42   is_nullable: 0
43
44 =head2 relationship
45
46   data_type: 'varchar'
47   is_nullable: 0
48   size: 100
49
50 =cut
51
52 __PACKAGE__->add_columns(
53   "id",
54   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
55   "guarantor_id",
56   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
57   "guarantee_id",
58   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
59   "relationship",
60   { data_type => "varchar", is_nullable => 0, size => 100 },
61 );
62
63 =head1 PRIMARY KEY
64
65 =over 4
66
67 =item * L</id>
68
69 =back
70
71 =cut
72
73 __PACKAGE__->set_primary_key("id");
74
75 =head1 UNIQUE CONSTRAINTS
76
77 =head2 C<guarantor_guarantee_idx>
78
79 =over 4
80
81 =item * L</guarantor_id>
82
83 =item * L</guarantee_id>
84
85 =back
86
87 =cut
88
89 __PACKAGE__->add_unique_constraint("guarantor_guarantee_idx", ["guarantor_id", "guarantee_id"]);
90
91 =head1 RELATIONS
92
93 =head2 guarantee
94
95 Type: belongs_to
96
97 Related object: L<Koha::Schema::Result::Borrower>
98
99 =cut
100
101 __PACKAGE__->belongs_to(
102   "guarantee",
103   "Koha::Schema::Result::Borrower",
104   { borrowernumber => "guarantee_id" },
105   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
106 );
107
108 =head2 guarantor
109
110 Type: belongs_to
111
112 Related object: L<Koha::Schema::Result::Borrower>
113
114 =cut
115
116 __PACKAGE__->belongs_to(
117   "guarantor",
118   "Koha::Schema::Result::Borrower",
119   { borrowernumber => "guarantor_id" },
120   {
121     is_deferrable => 1,
122     join_type     => "LEFT",
123     on_delete     => "CASCADE",
124     on_update     => "CASCADE",
125   },
126 );
127
128
129 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-08-20 15:14:37
130 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZymvWAn9Nzfuh1lExUIhIg
131
132 sub koha_objects_class {
133     'Koha::Patron::Relationships';
134 }
135 sub koha_object_class {
136     'Koha::Patron::Relationship';
137 }
138
139 1;