Bug 22417: DBIX Schema changes
[koha.git] / Koha / Schema / Result / Reserve.pm
1 use utf8;
2 package Koha::Schema::Result::Reserve;
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::Reserve
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<reserves>
19
20 =cut
21
22 __PACKAGE__->table("reserves");
23
24 =head1 ACCESSORS
25
26 =head2 reserve_id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 borrowernumber
33
34   data_type: 'integer'
35   default_value: 0
36   is_foreign_key: 1
37   is_nullable: 0
38
39 =head2 reservedate
40
41   data_type: 'date'
42   datetime_undef_if_invalid: 1
43   is_nullable: 1
44
45 =head2 biblionumber
46
47   data_type: 'integer'
48   default_value: 0
49   is_foreign_key: 1
50   is_nullable: 0
51
52 =head2 branchcode
53
54   data_type: 'varchar'
55   is_foreign_key: 1
56   is_nullable: 1
57   size: 10
58
59 =head2 notificationdate
60
61   data_type: 'date'
62   datetime_undef_if_invalid: 1
63   is_nullable: 1
64
65 =head2 reminderdate
66
67   data_type: 'date'
68   datetime_undef_if_invalid: 1
69   is_nullable: 1
70
71 =head2 cancellationdate
72
73   data_type: 'date'
74   datetime_undef_if_invalid: 1
75   is_nullable: 1
76
77 =head2 cancellation_reason
78
79   data_type: 'varchar'
80   is_nullable: 1
81   size: 80
82
83 =head2 reservenotes
84
85   data_type: 'longtext'
86   is_nullable: 1
87
88 =head2 priority
89
90   data_type: 'smallint'
91   default_value: 1
92   is_nullable: 0
93
94 =head2 found
95
96   data_type: 'varchar'
97   is_nullable: 1
98   size: 1
99
100 =head2 timestamp
101
102   data_type: 'timestamp'
103   datetime_undef_if_invalid: 1
104   default_value: current_timestamp
105   is_nullable: 0
106
107 =head2 itemnumber
108
109   data_type: 'integer'
110   is_foreign_key: 1
111   is_nullable: 1
112
113 =head2 waitingdate
114
115   data_type: 'date'
116   datetime_undef_if_invalid: 1
117   is_nullable: 1
118
119 =head2 expirationdate
120
121   data_type: 'date'
122   datetime_undef_if_invalid: 1
123   is_nullable: 1
124
125 =head2 lowestPriority
126
127   accessor: 'lowest_priority'
128   data_type: 'tinyint'
129   default_value: 0
130   is_nullable: 0
131
132 =head2 suspend
133
134   data_type: 'tinyint'
135   default_value: 0
136   is_nullable: 0
137
138 =head2 suspend_until
139
140   data_type: 'datetime'
141   datetime_undef_if_invalid: 1
142   is_nullable: 1
143
144 =head2 itemtype
145
146   data_type: 'varchar'
147   is_foreign_key: 1
148   is_nullable: 1
149   size: 10
150
151 =head2 item_level_hold
152
153   data_type: 'tinyint'
154   default_value: 0
155   is_nullable: 0
156
157 =head2 non_priority
158
159   data_type: 'tinyint'
160   default_value: 0
161   is_nullable: 0
162
163 =cut
164
165 __PACKAGE__->add_columns(
166   "reserve_id",
167   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
168   "borrowernumber",
169   {
170     data_type      => "integer",
171     default_value  => 0,
172     is_foreign_key => 1,
173     is_nullable    => 0,
174   },
175   "reservedate",
176   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
177   "biblionumber",
178   {
179     data_type      => "integer",
180     default_value  => 0,
181     is_foreign_key => 1,
182     is_nullable    => 0,
183   },
184   "branchcode",
185   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
186   "notificationdate",
187   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
188   "reminderdate",
189   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
190   "cancellationdate",
191   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
192   "cancellation_reason",
193   { data_type => "varchar", is_nullable => 1, size => 80 },
194   "reservenotes",
195   { data_type => "longtext", is_nullable => 1 },
196   "priority",
197   { data_type => "smallint", default_value => 1, is_nullable => 0 },
198   "found",
199   { data_type => "varchar", is_nullable => 1, size => 1 },
200   "timestamp",
201   {
202     data_type => "timestamp",
203     datetime_undef_if_invalid => 1,
204     default_value => \"current_timestamp",
205     is_nullable => 0,
206   },
207   "itemnumber",
208   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
209   "waitingdate",
210   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
211   "expirationdate",
212   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
213   "lowestPriority",
214   {
215     accessor      => "lowest_priority",
216     data_type     => "tinyint",
217     default_value => 0,
218     is_nullable   => 0,
219   },
220   "suspend",
221   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
222   "suspend_until",
223   {
224     data_type => "datetime",
225     datetime_undef_if_invalid => 1,
226     is_nullable => 1,
227   },
228   "itemtype",
229   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
230   "item_level_hold",
231   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
232   "non_priority",
233   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
234 );
235
236 =head1 PRIMARY KEY
237
238 =over 4
239
240 =item * L</reserve_id>
241
242 =back
243
244 =cut
245
246 __PACKAGE__->set_primary_key("reserve_id");
247
248 =head1 RELATIONS
249
250 =head2 biblionumber
251
252 Type: belongs_to
253
254 Related object: L<Koha::Schema::Result::Biblio>
255
256 =cut
257
258 __PACKAGE__->belongs_to(
259   "biblionumber",
260   "Koha::Schema::Result::Biblio",
261   { biblionumber => "biblionumber" },
262   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
263 );
264
265 =head2 borrowernumber
266
267 Type: belongs_to
268
269 Related object: L<Koha::Schema::Result::Borrower>
270
271 =cut
272
273 __PACKAGE__->belongs_to(
274   "borrowernumber",
275   "Koha::Schema::Result::Borrower",
276   { borrowernumber => "borrowernumber" },
277   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
278 );
279
280 =head2 branchcode
281
282 Type: belongs_to
283
284 Related object: L<Koha::Schema::Result::Branch>
285
286 =cut
287
288 __PACKAGE__->belongs_to(
289   "branchcode",
290   "Koha::Schema::Result::Branch",
291   { branchcode => "branchcode" },
292   {
293     is_deferrable => 1,
294     join_type     => "LEFT",
295     on_delete     => "CASCADE",
296     on_update     => "CASCADE",
297   },
298 );
299
300 =head2 club_holds_to_patron_holds
301
302 Type: has_many
303
304 Related object: L<Koha::Schema::Result::ClubHoldsToPatronHold>
305
306 =cut
307
308 __PACKAGE__->has_many(
309   "club_holds_to_patron_holds",
310   "Koha::Schema::Result::ClubHoldsToPatronHold",
311   { "foreign.hold_id" => "self.reserve_id" },
312   { cascade_copy => 0, cascade_delete => 0 },
313 );
314
315 =head2 itemnumber
316
317 Type: belongs_to
318
319 Related object: L<Koha::Schema::Result::Item>
320
321 =cut
322
323 __PACKAGE__->belongs_to(
324   "itemnumber",
325   "Koha::Schema::Result::Item",
326   { itemnumber => "itemnumber" },
327   {
328     is_deferrable => 1,
329     join_type     => "LEFT",
330     on_delete     => "CASCADE",
331     on_update     => "CASCADE",
332   },
333 );
334
335 =head2 itemtype
336
337 Type: belongs_to
338
339 Related object: L<Koha::Schema::Result::Itemtype>
340
341 =cut
342
343 __PACKAGE__->belongs_to(
344   "itemtype",
345   "Koha::Schema::Result::Itemtype",
346   { itemtype => "itemtype" },
347   {
348     is_deferrable => 1,
349     join_type     => "LEFT",
350     on_delete     => "CASCADE",
351     on_update     => "CASCADE",
352   },
353 );
354
355
356 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-08-31 14:16:48
357 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:goRy3ZQWpGNmicok5Av37Q
358
359 __PACKAGE__->belongs_to(
360   "item",
361   "Koha::Schema::Result::Item",
362   { itemnumber => "itemnumber" },
363   {
364     is_deferrable => 1,
365     join_type     => "LEFT",
366     on_delete     => "CASCADE",
367     on_update     => "CASCADE",
368   },
369 );
370
371 __PACKAGE__->belongs_to(
372   "biblio",
373   "Koha::Schema::Result::Biblio",
374   { biblionumber => "biblionumber" },
375   {
376     is_deferrable => 1,
377     join_type     => "LEFT",
378     on_delete     => "CASCADE",
379     on_update     => "CASCADE",
380   },
381 );
382
383 __PACKAGE__->add_columns(
384     '+item_level_hold' => { is_boolean => 1 },
385     '+lowestPriority'  => { is_boolean => 1 },
386     '+suspend'         => { is_boolean => 1 },
387     '+non_priority'    => { is_boolean => 1 }
388 );
389
390 sub koha_object_class {
391     'Koha::Hold';
392 }
393 sub koha_objects_class {
394     'Koha::Holds';
395 }
396
397 1;