Bug 25534: DBIC 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 =cut
158
159 __PACKAGE__->add_columns(
160   "reserve_id",
161   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
162   "borrowernumber",
163   {
164     data_type      => "integer",
165     default_value  => 0,
166     is_foreign_key => 1,
167     is_nullable    => 0,
168   },
169   "reservedate",
170   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
171   "biblionumber",
172   {
173     data_type      => "integer",
174     default_value  => 0,
175     is_foreign_key => 1,
176     is_nullable    => 0,
177   },
178   "branchcode",
179   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
180   "notificationdate",
181   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
182   "reminderdate",
183   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
184   "cancellationdate",
185   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
186   "cancellation_reason",
187   { data_type => "varchar", is_nullable => 1, size => 80 },
188   "reservenotes",
189   { data_type => "longtext", is_nullable => 1 },
190   "priority",
191   { data_type => "smallint", default_value => 1, is_nullable => 0 },
192   "found",
193   { data_type => "varchar", is_nullable => 1, size => 1 },
194   "timestamp",
195   {
196     data_type => "timestamp",
197     datetime_undef_if_invalid => 1,
198     default_value => \"current_timestamp",
199     is_nullable => 0,
200   },
201   "itemnumber",
202   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
203   "waitingdate",
204   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
205   "expirationdate",
206   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
207   "lowestPriority",
208   {
209     accessor      => "lowest_priority",
210     data_type     => "tinyint",
211     default_value => 0,
212     is_nullable   => 0,
213   },
214   "suspend",
215   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
216   "suspend_until",
217   {
218     data_type => "datetime",
219     datetime_undef_if_invalid => 1,
220     is_nullable => 1,
221   },
222   "itemtype",
223   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
224   "item_level_hold",
225   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
226 );
227
228 =head1 PRIMARY KEY
229
230 =over 4
231
232 =item * L</reserve_id>
233
234 =back
235
236 =cut
237
238 __PACKAGE__->set_primary_key("reserve_id");
239
240 =head1 RELATIONS
241
242 =head2 biblionumber
243
244 Type: belongs_to
245
246 Related object: L<Koha::Schema::Result::Biblio>
247
248 =cut
249
250 __PACKAGE__->belongs_to(
251   "biblionumber",
252   "Koha::Schema::Result::Biblio",
253   { biblionumber => "biblionumber" },
254   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
255 );
256
257 =head2 borrowernumber
258
259 Type: belongs_to
260
261 Related object: L<Koha::Schema::Result::Borrower>
262
263 =cut
264
265 __PACKAGE__->belongs_to(
266   "borrowernumber",
267   "Koha::Schema::Result::Borrower",
268   { borrowernumber => "borrowernumber" },
269   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
270 );
271
272 =head2 branchcode
273
274 Type: belongs_to
275
276 Related object: L<Koha::Schema::Result::Branch>
277
278 =cut
279
280 __PACKAGE__->belongs_to(
281   "branchcode",
282   "Koha::Schema::Result::Branch",
283   { branchcode => "branchcode" },
284   {
285     is_deferrable => 1,
286     join_type     => "LEFT",
287     on_delete     => "CASCADE",
288     on_update     => "CASCADE",
289   },
290 );
291
292 =head2 club_holds_to_patron_holds
293
294 Type: has_many
295
296 Related object: L<Koha::Schema::Result::ClubHoldsToPatronHold>
297
298 =cut
299
300 __PACKAGE__->has_many(
301   "club_holds_to_patron_holds",
302   "Koha::Schema::Result::ClubHoldsToPatronHold",
303   { "foreign.hold_id" => "self.reserve_id" },
304   { cascade_copy => 0, cascade_delete => 0 },
305 );
306
307 =head2 itemnumber
308
309 Type: belongs_to
310
311 Related object: L<Koha::Schema::Result::Item>
312
313 =cut
314
315 __PACKAGE__->belongs_to(
316   "itemnumber",
317   "Koha::Schema::Result::Item",
318   { itemnumber => "itemnumber" },
319   {
320     is_deferrable => 1,
321     join_type     => "LEFT",
322     on_delete     => "CASCADE",
323     on_update     => "CASCADE",
324   },
325 );
326
327 =head2 itemtype
328
329 Type: belongs_to
330
331 Related object: L<Koha::Schema::Result::Itemtype>
332
333 =cut
334
335 __PACKAGE__->belongs_to(
336   "itemtype",
337   "Koha::Schema::Result::Itemtype",
338   { itemtype => "itemtype" },
339   {
340     is_deferrable => 1,
341     join_type     => "LEFT",
342     on_delete     => "CASCADE",
343     on_update     => "CASCADE",
344   },
345 );
346
347
348 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-08-25 13:08:15
349 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qdEIwB+DOrraRb+zd4F6yQ
350
351 __PACKAGE__->belongs_to(
352   "item",
353   "Koha::Schema::Result::Item",
354   { itemnumber => "itemnumber" },
355   {
356     is_deferrable => 1,
357     join_type     => "LEFT",
358     on_delete     => "CASCADE",
359     on_update     => "CASCADE",
360   },
361 );
362
363 __PACKAGE__->belongs_to(
364   "biblio",
365   "Koha::Schema::Result::Biblio",
366   { biblionumber => "biblionumber" },
367   {
368     is_deferrable => 1,
369     join_type     => "LEFT",
370     on_delete     => "CASCADE",
371     on_update     => "CASCADE",
372   },
373 );
374
375 __PACKAGE__->add_columns(
376     '+item_level_hold' => { is_boolean => 1 },
377     '+lowestPriority'  => { is_boolean => 1 },
378     '+suspend'         => { is_boolean => 1 }
379 );
380
381 sub koha_object_class {
382     'Koha::Hold';
383 }
384 sub koha_objects_class {
385     'Koha::Holds';
386 }
387
388 1;