Bug 30612: Update schema files
[koha.git] / Koha / Schema / Result / OldIssue.pm
1 use utf8;
2 package Koha::Schema::Result::OldIssue;
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::OldIssue
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<old_issues>
19
20 =cut
21
22 __PACKAGE__->table("old_issues");
23
24 =head1 ACCESSORS
25
26 =head2 issue_id
27
28   data_type: 'integer'
29   is_nullable: 0
30
31 primary key for issues table
32
33 =head2 borrowernumber
34
35   data_type: 'integer'
36   is_foreign_key: 1
37   is_nullable: 1
38
39 foreign key, linking this to the borrowers table for the patron this item was checked out to
40
41 =head2 issuer_id
42
43   data_type: 'integer'
44   is_foreign_key: 1
45   is_nullable: 1
46
47 foreign key, linking this to the borrowers table for the user who checked out this item
48
49 =head2 itemnumber
50
51   data_type: 'integer'
52   is_foreign_key: 1
53   is_nullable: 1
54
55 foreign key, linking this to the items table for the item that was checked out
56
57 =head2 date_due
58
59   data_type: 'datetime'
60   datetime_undef_if_invalid: 1
61   is_nullable: 1
62
63 date the item is due (yyyy-mm-dd)
64
65 =head2 branchcode
66
67   data_type: 'varchar'
68   is_nullable: 1
69   size: 10
70
71 foreign key, linking to the branches table for the location the item was checked out
72
73 =head2 returndate
74
75   data_type: 'datetime'
76   datetime_undef_if_invalid: 1
77   is_nullable: 1
78
79 date the item was returned
80
81 =head2 lastreneweddate
82
83   data_type: 'datetime'
84   datetime_undef_if_invalid: 1
85   is_nullable: 1
86
87 date the item was last renewed
88
89 =head2 renewals_count
90
91   data_type: 'tinyint'
92   default_value: 0
93   is_nullable: 0
94
95 lists the number of times the item was renewed
96
97 =head2 unseen_renewals
98
99   data_type: 'tinyint'
100   default_value: 0
101   is_nullable: 0
102
103 lists the number of consecutive times the item was renewed without being seen
104
105 =head2 auto_renew
106
107   data_type: 'tinyint'
108   default_value: 0
109   is_nullable: 1
110
111 automatic renewal
112
113 =head2 auto_renew_error
114
115   data_type: 'varchar'
116   is_nullable: 1
117   size: 32
118
119 automatic renewal error
120
121 =head2 timestamp
122
123   data_type: 'timestamp'
124   datetime_undef_if_invalid: 1
125   default_value: current_timestamp
126   is_nullable: 0
127
128 the date and time this record was last touched
129
130 =head2 issuedate
131
132   data_type: 'datetime'
133   datetime_undef_if_invalid: 1
134   is_nullable: 1
135
136 date the item was checked out or issued
137
138 =head2 onsite_checkout
139
140   data_type: 'integer'
141   default_value: 0
142   is_nullable: 0
143
144 in house use flag
145
146 =head2 note
147
148   data_type: 'longtext'
149   is_nullable: 1
150
151 issue note text
152
153 =head2 notedate
154
155   data_type: 'datetime'
156   datetime_undef_if_invalid: 1
157   is_nullable: 1
158
159 datetime of issue note (yyyy-mm-dd hh:mm::ss)
160
161 =head2 noteseen
162
163   data_type: 'integer'
164   is_nullable: 1
165
166 describes whether checkout note has been seen 1, not been seen 0 or doesn't exist null
167
168 =cut
169
170 __PACKAGE__->add_columns(
171   "issue_id",
172   { data_type => "integer", is_nullable => 0 },
173   "borrowernumber",
174   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
175   "issuer_id",
176   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
177   "itemnumber",
178   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
179   "date_due",
180   {
181     data_type => "datetime",
182     datetime_undef_if_invalid => 1,
183     is_nullable => 1,
184   },
185   "branchcode",
186   { data_type => "varchar", is_nullable => 1, size => 10 },
187   "returndate",
188   {
189     data_type => "datetime",
190     datetime_undef_if_invalid => 1,
191     is_nullable => 1,
192   },
193   "lastreneweddate",
194   {
195     data_type => "datetime",
196     datetime_undef_if_invalid => 1,
197     is_nullable => 1,
198   },
199   "renewals_count",
200   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
201   "unseen_renewals",
202   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
203   "auto_renew",
204   { data_type => "tinyint", default_value => 0, is_nullable => 1 },
205   "auto_renew_error",
206   { data_type => "varchar", is_nullable => 1, size => 32 },
207   "timestamp",
208   {
209     data_type => "timestamp",
210     datetime_undef_if_invalid => 1,
211     default_value => \"current_timestamp",
212     is_nullable => 0,
213   },
214   "issuedate",
215   {
216     data_type => "datetime",
217     datetime_undef_if_invalid => 1,
218     is_nullable => 1,
219   },
220   "onsite_checkout",
221   { data_type => "integer", default_value => 0, is_nullable => 0 },
222   "note",
223   { data_type => "longtext", is_nullable => 1 },
224   "notedate",
225   {
226     data_type => "datetime",
227     datetime_undef_if_invalid => 1,
228     is_nullable => 1,
229   },
230   "noteseen",
231   { data_type => "integer", is_nullable => 1 },
232 );
233
234 =head1 PRIMARY KEY
235
236 =over 4
237
238 =item * L</issue_id>
239
240 =back
241
242 =cut
243
244 __PACKAGE__->set_primary_key("issue_id");
245
246 =head1 RELATIONS
247
248 =head2 borrowernumber
249
250 Type: belongs_to
251
252 Related object: L<Koha::Schema::Result::Borrower>
253
254 =cut
255
256 __PACKAGE__->belongs_to(
257   "borrowernumber",
258   "Koha::Schema::Result::Borrower",
259   { borrowernumber => "borrowernumber" },
260   {
261     is_deferrable => 1,
262     join_type     => "LEFT",
263     on_delete     => "SET NULL",
264     on_update     => "SET NULL",
265   },
266 );
267
268 =head2 issuer
269
270 Type: belongs_to
271
272 Related object: L<Koha::Schema::Result::Borrower>
273
274 =cut
275
276 __PACKAGE__->belongs_to(
277   "issuer",
278   "Koha::Schema::Result::Borrower",
279   { borrowernumber => "issuer_id" },
280   {
281     is_deferrable => 1,
282     join_type     => "LEFT",
283     on_delete     => "SET NULL",
284     on_update     => "CASCADE",
285   },
286 );
287
288 =head2 itemnumber
289
290 Type: belongs_to
291
292 Related object: L<Koha::Schema::Result::Item>
293
294 =cut
295
296 __PACKAGE__->belongs_to(
297   "itemnumber",
298   "Koha::Schema::Result::Item",
299   { itemnumber => "itemnumber" },
300   {
301     is_deferrable => 1,
302     join_type     => "LEFT",
303     on_delete     => "SET NULL",
304     on_update     => "SET NULL",
305   },
306 );
307
308
309 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-03-18 12:35:21
310 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0XlDHyg8uB3oD9/jJtOxRg
311
312 __PACKAGE__->add_columns(
313     '+auto_renew'      => { is_boolean => 1 },
314     '+onsite_checkout' => { is_boolean => 1 }
315 );
316
317 __PACKAGE__->belongs_to(
318     "patron",
319     "Koha::Schema::Result::Borrower",
320     { borrowernumber => "borrowernumber" },
321     { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
322 );
323
324 __PACKAGE__->belongs_to(
325   "item",
326   "Koha::Schema::Result::Item",
327   { itemnumber => "itemnumber" },
328   {
329     is_deferrable => 1,
330     join_type     => "LEFT",
331     on_delete     => "CASCADE",
332     on_update     => "CASCADE",
333   },
334 );
335
336 __PACKAGE__->belongs_to(
337   "library",
338   "Koha::Schema::Result::Branch",
339   { "foreign.branchcode" => "self.branchcode" },
340   {
341     is_deferrable => 1,
342     join_type     => "LEFT",
343   },
344 );
345
346 =head2 renewals
347
348 Type: has_many
349
350 Related object: L<Koha::Schema::Result::CheckoutRenewal>
351
352 =cut
353
354 __PACKAGE__->has_many(
355     "renewals",
356     "Koha::Schema::Result::CheckoutRenewal",
357     { "foreign.checkout_id" => "self.issue_id" },
358     { cascade_copy       => 0, cascade_delete => 0 },
359 );
360
361 =head2 return_claim
362
363 Type: might_have
364
365 Related object: L<Koha::Schema::Result::ReturnClaim>
366
367 =cut
368
369 __PACKAGE__->has_many(
370     "accountlines",
371     "Koha::Schema::Result::Accountline",
372     { "foreign.issue_id" => "self.issue_id" },
373     { cascade_copy       => 0, cascade_delete => 0 },
374 );
375
376 __PACKAGE__->might_have(
377     "return_claim",
378     "Koha::Schema::Result::ReturnClaim",
379     { "foreign.issue_id" => "self.issue_id" },
380     { cascade_copy       => 0, cascade_delete => 0 },
381 );
382
383 sub koha_object_class {
384     'Koha::Old::Checkout';
385 }
386 sub koha_objects_class {
387     'Koha::Old::Checkouts';
388 }
389
390 1;