Bug 23727: (QA follow-up) Fix for boolean flags
[koha.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 holdingbranch
75
76   data_type: 'varchar'
77   is_foreign_key: 1
78   is_nullable: 1
79   size: 10
80
81 =head2 holdingbranch_enabled
82
83   data_type: 'tinyint'
84   default_value: 0
85   is_nullable: 0
86
87 =head2 holdingbranch_storage
88
89   data_type: 'varchar'
90   is_nullable: 1
91   size: 10
92
93 =head2 location
94
95   data_type: 'varchar'
96   is_nullable: 1
97   size: 80
98
99 =head2 location_enabled
100
101   data_type: 'tinyint'
102   default_value: 0
103   is_nullable: 0
104
105 =head2 location_storage
106
107   data_type: 'varchar'
108   is_nullable: 1
109   size: 80
110
111 =head2 enabled
112
113   data_type: 'enum'
114   default_value: 'no'
115   extra: {list => ["yes","no"]}
116   is_nullable: 0
117
118 =head2 timestamp
119
120   data_type: 'timestamp'
121   datetime_undef_if_invalid: 1
122   default_value: current_timestamp
123   is_nullable: 0
124
125 =cut
126
127 __PACKAGE__->add_columns(
128   "ci_id",
129   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
130   "itemnumber",
131   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
132   "itype",
133   { data_type => "varchar", is_nullable => 1, size => 10 },
134   "itype_enabled",
135   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
136   "itype_storage",
137   { data_type => "varchar", is_nullable => 1, size => 10 },
138   "ccode",
139   { data_type => "varchar", is_nullable => 1, size => 80 },
140   "ccode_enabled",
141   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
142   "ccode_storage",
143   { data_type => "varchar", is_nullable => 1, size => 80 },
144   "holdingbranch",
145   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
146   "holdingbranch_enabled",
147   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
148   "holdingbranch_storage",
149   { data_type => "varchar", is_nullable => 1, size => 10 },
150   "location",
151   { data_type => "varchar", is_nullable => 1, size => 80 },
152   "location_enabled",
153   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
154   "location_storage",
155   { data_type => "varchar", is_nullable => 1, size => 80 },
156   "enabled",
157   {
158     data_type => "enum",
159     default_value => "no",
160     extra => { list => ["yes", "no"] },
161     is_nullable => 0,
162   },
163   "timestamp",
164   {
165     data_type => "timestamp",
166     datetime_undef_if_invalid => 1,
167     default_value => \"current_timestamp",
168     is_nullable => 0,
169   },
170 );
171
172 =head1 PRIMARY KEY
173
174 =over 4
175
176 =item * L</ci_id>
177
178 =back
179
180 =cut
181
182 __PACKAGE__->set_primary_key("ci_id");
183
184 =head1 UNIQUE CONSTRAINTS
185
186 =head2 C<itemnumber>
187
188 =over 4
189
190 =item * L</itemnumber>
191
192 =back
193
194 =cut
195
196 __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]);
197
198 =head1 RELATIONS
199
200 =head2 course_reserves
201
202 Type: has_many
203
204 Related object: L<Koha::Schema::Result::CourseReserve>
205
206 =cut
207
208 __PACKAGE__->has_many(
209   "course_reserves",
210   "Koha::Schema::Result::CourseReserve",
211   { "foreign.ci_id" => "self.ci_id" },
212   { cascade_copy => 0, cascade_delete => 0 },
213 );
214
215 =head2 holdingbranch
216
217 Type: belongs_to
218
219 Related object: L<Koha::Schema::Result::Branch>
220
221 =cut
222
223 __PACKAGE__->belongs_to(
224   "holdingbranch",
225   "Koha::Schema::Result::Branch",
226   { branchcode => "holdingbranch" },
227   {
228     is_deferrable => 1,
229     join_type     => "LEFT",
230     on_delete     => "CASCADE",
231     on_update     => "CASCADE",
232   },
233 );
234
235 =head2 itemnumber
236
237 Type: belongs_to
238
239 Related object: L<Koha::Schema::Result::Item>
240
241 =cut
242
243 __PACKAGE__->belongs_to(
244   "itemnumber",
245   "Koha::Schema::Result::Item",
246   { itemnumber => "itemnumber" },
247   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
248 );
249
250
251 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-19 16:07:13
252 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8tTH0fAzewvaXRYs8+VZcg
253
254 __PACKAGE__->add_columns(
255     '+itype_enabled'         => { is_boolean => 1 },
256     '+ccode_enabled'         => { is_boolean => 1 },
257     '+holdingbranch_enabled' => { is_boolean => 1 },
258     '+location_enabled'      => { is_boolean => 1 },
259 );
260
261 sub koha_objects_class {
262     'Koha::Course::Items';
263 }
264 sub koha_object_class {
265     'Koha::Course::Item';
266 }
267
268 1;