Bug 18930: (RM follow-up) Restore primary key find
[koha-equinox.git] / Koha / Schema / Result / CirculationRule.pm
1 use utf8;
2 package Koha::Schema::Result::CirculationRule;
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::CirculationRule
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<circulation_rules>
19
20 =cut
21
22 __PACKAGE__->table("circulation_rules");
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 branchcode
33
34   data_type: 'varchar'
35   is_foreign_key: 1
36   is_nullable: 1
37   size: 10
38
39 =head2 categorycode
40
41   data_type: 'varchar'
42   is_foreign_key: 1
43   is_nullable: 1
44   size: 10
45
46 =head2 itemtype
47
48   data_type: 'varchar'
49   is_foreign_key: 1
50   is_nullable: 1
51   size: 10
52
53 =head2 rule_name
54
55   data_type: 'varchar'
56   is_nullable: 0
57   size: 32
58
59 =head2 rule_value
60
61   data_type: 'varchar'
62   is_nullable: 0
63   size: 32
64
65 =cut
66
67 __PACKAGE__->add_columns(
68   "id",
69   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
70   "branchcode",
71   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
72   "categorycode",
73   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
74   "itemtype",
75   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
76   "rule_name",
77   { data_type => "varchar", is_nullable => 0, size => 32 },
78   "rule_value",
79   { data_type => "varchar", is_nullable => 0, size => 32 },
80 );
81
82 =head1 PRIMARY KEY
83
84 =over 4
85
86 =item * L</id>
87
88 =back
89
90 =cut
91
92 __PACKAGE__->set_primary_key("id");
93
94 =head1 UNIQUE CONSTRAINTS
95
96 =head2 C<branchcode>
97
98 =over 4
99
100 =item * L</branchcode>
101
102 =item * L</categorycode>
103
104 =item * L</itemtype>
105
106 =item * L</rule_name>
107
108 =back
109
110 =cut
111
112 __PACKAGE__->add_unique_constraint(
113   "branchcode",
114   ["branchcode", "categorycode", "itemtype", "rule_name"],
115 );
116
117 =head1 RELATIONS
118
119 =head2 branchcode
120
121 Type: belongs_to
122
123 Related object: L<Koha::Schema::Result::Branch>
124
125 =cut
126
127 __PACKAGE__->belongs_to(
128   "branchcode",
129   "Koha::Schema::Result::Branch",
130   { branchcode => "branchcode" },
131   {
132     is_deferrable => 1,
133     join_type     => "LEFT",
134     on_delete     => "CASCADE",
135     on_update     => "CASCADE",
136   },
137 );
138
139 =head2 categorycode
140
141 Type: belongs_to
142
143 Related object: L<Koha::Schema::Result::Category>
144
145 =cut
146
147 __PACKAGE__->belongs_to(
148   "categorycode",
149   "Koha::Schema::Result::Category",
150   { categorycode => "categorycode" },
151   {
152     is_deferrable => 1,
153     join_type     => "LEFT",
154     on_delete     => "CASCADE",
155     on_update     => "CASCADE",
156   },
157 );
158
159 =head2 itemtype
160
161 Type: belongs_to
162
163 Related object: L<Koha::Schema::Result::Itemtype>
164
165 =cut
166
167 __PACKAGE__->belongs_to(
168   "itemtype",
169   "Koha::Schema::Result::Itemtype",
170   { itemtype => "itemtype" },
171   {
172     is_deferrable => 1,
173     join_type     => "LEFT",
174     on_delete     => "CASCADE",
175     on_update     => "CASCADE",
176   },
177 );
178
179
180 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-05 14:29:17
181 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QHMqvrtX0ohJe70PHUYZ0Q
182
183 sub koha_objects_class {
184     'Koha::CirculationRules';
185 }
186
187 sub koha_object_class {
188     'Koha::CirculationRule';
189 }
190
191 # You can replace this text with custom code or comments, and it will be preserved on regeneration
192 1;