Bug 22630: Update Koha::Schema::Result::CourseItem
[koha-equinox.git] / Koha / Schema / Result / CourseItem.pm
1 use utf8;
2 package Koha::Schema::Result::CourseItem;
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::CourseItem
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<course_items>
19
20 =cut
21
22 __PACKAGE__->table("course_items");
23
24 =head1 ACCESSORS
25
26 =head2 ci_id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 itemnumber
33
34   data_type: 'integer'
35   is_foreign_key: 1
36   is_nullable: 0
37
38 =head2 itype
39
40   data_type: 'varchar'
41   is_nullable: 1
42   size: 10
43
44 =head2 itype_enabled
45
46   data_type: 'tinyint'
47   default_value: 0
48   is_nullable: 0
49
50 =head2 itype_storage
51
52   data_type: 'varchar'
53   is_nullable: 1
54   size: 10
55
56 =head2 ccode
57
58   data_type: 'varchar'
59   is_nullable: 1
60   size: 80
61
62 =head2 ccode_enabled
63
64   data_type: 'tinyint'
65   default_value: 0
66   is_nullable: 0
67
68 =head2 ccode_storage
69
70   data_type: 'varchar'
71   is_nullable: 1
72   size: 80
73
74 =head2 homebranch
75
76   data_type: 'varchar'
77   is_foreign_key: 1
78   is_nullable: 1
79   size: 10
80
81 =head2 homebranch_enabled
82
83   data_type: 'tinyint'
84   default_value: 0
85   is_nullable: 0
86
87 =head2 homebranch_storage
88
89   data_type: 'varchar'
90   is_foreign_key: 1
91   is_nullable: 1
92   size: 10
93
94 =head2 holdingbranch
95
96   data_type: 'varchar'
97   is_foreign_key: 1
98   is_nullable: 1
99   size: 10
100
101 =head2 holdingbranch_enabled
102
103   data_type: 'tinyint'
104   default_value: 0
105   is_nullable: 0
106
107 =head2 holdingbranch_storage
108
109   data_type: 'varchar'
110   is_nullable: 1
111   size: 10
112
113 =head2 location
114
115   data_type: 'varchar'
116   is_nullable: 1
117   size: 80
118
119 =head2 location_enabled
120
121   data_type: 'tinyint'
122   default_value: 0
123   is_nullable: 0
124
125 =head2 location_storage
126
127   data_type: 'varchar'
128   is_nullable: 1
129   size: 80
130
131 =head2 enabled
132
133   data_type: 'enum'
134   default_value: 'no'
135   extra: {list => ["yes","no"]}
136   is_nullable: 0
137
138 =head2 timestamp
139
140   data_type: 'timestamp'
141   datetime_undef_if_invalid: 1
142   default_value: current_timestamp
143   is_nullable: 0
144
145 =cut
146
147 __PACKAGE__->add_columns(
148   "ci_id",
149   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
150   "itemnumber",
151   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
152   "itype",
153   { data_type => "varchar", is_nullable => 1, size => 10 },
154   "itype_enabled",
155   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
156   "itype_storage",
157   { data_type => "varchar", is_nullable => 1, size => 10 },
158   "ccode",
159   { data_type => "varchar", is_nullable => 1, size => 80 },
160   "ccode_enabled",
161   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
162   "ccode_storage",
163   { data_type => "varchar", is_nullable => 1, size => 80 },
164   "homebranch",
165   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
166   "homebranch_enabled",
167   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
168   "homebranch_storage",
169   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
170   "holdingbranch",
171   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
172   "holdingbranch_enabled",
173   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
174   "holdingbranch_storage",
175   { data_type => "varchar", is_nullable => 1, size => 10 },
176   "location",
177   { data_type => "varchar", is_nullable => 1, size => 80 },
178   "location_enabled",
179   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
180   "location_storage",
181   { data_type => "varchar", is_nullable => 1, size => 80 },
182   "enabled",
183   {
184     data_type => "enum",
185     default_value => "no",
186     extra => { list => ["yes", "no"] },
187     is_nullable => 0,
188   },
189   "timestamp",
190   {
191     data_type => "timestamp",
192     datetime_undef_if_invalid => 1,
193     default_value => \"current_timestamp",
194     is_nullable => 0,
195   },
196 );
197
198 =head1 PRIMARY KEY
199
200 =over 4
201
202 =item * L</ci_id>
203
204 =back
205
206 =cut
207
208 __PACKAGE__->set_primary_key("ci_id");
209
210 =head1 UNIQUE CONSTRAINTS
211
212 =head2 C<itemnumber>
213
214 =over 4
215
216 =item * L</itemnumber>
217
218 =back
219
220 =cut
221
222 __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]);
223
224 =head1 RELATIONS
225
226 =head2 course_reserves
227
228 Type: has_many
229
230 Related object: L<Koha::Schema::Result::CourseReserve>
231
232 =cut
233
234 __PACKAGE__->has_many(
235   "course_reserves",
236   "Koha::Schema::Result::CourseReserve",
237   { "foreign.ci_id" => "self.ci_id" },
238   { cascade_copy => 0, cascade_delete => 0 },
239 );
240
241 =head2 holdingbranch
242
243 Type: belongs_to
244
245 Related object: L<Koha::Schema::Result::Branch>
246
247 =cut
248
249 __PACKAGE__->belongs_to(
250   "holdingbranch",
251   "Koha::Schema::Result::Branch",
252   { branchcode => "holdingbranch" },
253   {
254     is_deferrable => 1,
255     join_type     => "LEFT",
256     on_delete     => "CASCADE",
257     on_update     => "CASCADE",
258   },
259 );
260
261 =head2 homebranch
262
263 Type: belongs_to
264
265 Related object: L<Koha::Schema::Result::Branch>
266
267 =cut
268
269 __PACKAGE__->belongs_to(
270   "homebranch",
271   "Koha::Schema::Result::Branch",
272   { branchcode => "homebranch" },
273   {
274     is_deferrable => 1,
275     join_type     => "LEFT",
276     on_delete     => "CASCADE",
277     on_update     => "CASCADE",
278   },
279 );
280
281 =head2 homebranch_storage
282
283 Type: belongs_to
284
285 Related object: L<Koha::Schema::Result::Branch>
286
287 =cut
288
289 __PACKAGE__->belongs_to(
290   "homebranch_storage",
291   "Koha::Schema::Result::Branch",
292   { branchcode => "homebranch_storage" },
293   {
294     is_deferrable => 1,
295     join_type     => "LEFT",
296     on_delete     => "CASCADE",
297     on_update     => "CASCADE",
298   },
299 );
300
301 =head2 itemnumber
302
303 Type: belongs_to
304
305 Related object: L<Koha::Schema::Result::Item>
306
307 =cut
308
309 __PACKAGE__->belongs_to(
310   "itemnumber",
311   "Koha::Schema::Result::Item",
312   { itemnumber => "itemnumber" },
313   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
314 );
315
316
317 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-04-24 10:54:54
318 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cXNlGAgIZMs+Id7/FJSBRQ
319
320 __PACKAGE__->add_columns(
321     '+itype_enabled'         => { is_boolean => 1 },
322     '+ccode_enabled'         => { is_boolean => 1 },
323     '+holdingbranch_enabled' => { is_boolean => 1 },
324     '+location_enabled'      => { is_boolean => 1 },
325 );
326
327 sub koha_objects_class {
328     'Koha::Course::Items';
329 }
330 sub koha_object_class {
331     'Koha::Course::Item';
332 }
333
334 1;