Line 0
Link Here
|
|
|
1 |
use utf8; |
2 |
package Koha::Schema::Result::Holding; |
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::Holding |
10 |
|
11 |
=cut |
12 |
|
13 |
use strict; |
14 |
use warnings; |
15 |
|
16 |
use base 'DBIx::Class::Core'; |
17 |
|
18 |
=head1 TABLE: C<holdings> |
19 |
|
20 |
=cut |
21 |
|
22 |
__PACKAGE__->table("holdings"); |
23 |
|
24 |
=head1 ACCESSORS |
25 |
|
26 |
=head2 holding_id |
27 |
|
28 |
data_type: 'integer' |
29 |
is_auto_increment: 1 |
30 |
is_nullable: 0 |
31 |
|
32 |
=head2 biblionumber |
33 |
|
34 |
data_type: 'integer' |
35 |
default_value: 0 |
36 |
is_foreign_key: 1 |
37 |
is_nullable: 0 |
38 |
|
39 |
=head2 frameworkcode |
40 |
|
41 |
data_type: 'varchar' |
42 |
default_value: (empty string) |
43 |
is_nullable: 0 |
44 |
size: 4 |
45 |
|
46 |
=head2 holdingbranch |
47 |
|
48 |
data_type: 'varchar' |
49 |
is_foreign_key: 1 |
50 |
is_nullable: 1 |
51 |
size: 10 |
52 |
|
53 |
=head2 location |
54 |
|
55 |
data_type: 'varchar' |
56 |
is_nullable: 1 |
57 |
size: 80 |
58 |
|
59 |
=head2 ccode |
60 |
|
61 |
data_type: 'varchar' |
62 |
is_nullable: 1 |
63 |
size: 80 |
64 |
|
65 |
=head2 callnumber |
66 |
|
67 |
data_type: 'varchar' |
68 |
is_nullable: 1 |
69 |
size: 255 |
70 |
|
71 |
=head2 suppress |
72 |
|
73 |
data_type: 'tinyint' |
74 |
is_nullable: 1 |
75 |
|
76 |
=head2 timestamp |
77 |
|
78 |
data_type: 'timestamp' |
79 |
datetime_undef_if_invalid: 1 |
80 |
default_value: current_timestamp |
81 |
is_nullable: 0 |
82 |
|
83 |
=head2 datecreated |
84 |
|
85 |
data_type: 'date' |
86 |
datetime_undef_if_invalid: 1 |
87 |
is_nullable: 0 |
88 |
|
89 |
=head2 deleted_on |
90 |
|
91 |
data_type: 'datetime' |
92 |
datetime_undef_if_invalid: 1 |
93 |
is_nullable: 1 |
94 |
|
95 |
=cut |
96 |
|
97 |
__PACKAGE__->add_columns( |
98 |
"holding_id", |
99 |
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, |
100 |
"biblionumber", |
101 |
{ |
102 |
data_type => "integer", |
103 |
default_value => 0, |
104 |
is_foreign_key => 1, |
105 |
is_nullable => 0, |
106 |
}, |
107 |
"frameworkcode", |
108 |
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 4 }, |
109 |
"holdingbranch", |
110 |
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, |
111 |
"location", |
112 |
{ data_type => "varchar", is_nullable => 1, size => 80 }, |
113 |
"ccode", |
114 |
{ data_type => "varchar", is_nullable => 1, size => 80 }, |
115 |
"callnumber", |
116 |
{ data_type => "varchar", is_nullable => 1, size => 255 }, |
117 |
"suppress", |
118 |
{ data_type => "tinyint", is_nullable => 1 }, |
119 |
"timestamp", |
120 |
{ |
121 |
data_type => "timestamp", |
122 |
datetime_undef_if_invalid => 1, |
123 |
default_value => \"current_timestamp", |
124 |
is_nullable => 0, |
125 |
}, |
126 |
"datecreated", |
127 |
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 }, |
128 |
"deleted_on", |
129 |
{ |
130 |
data_type => "datetime", |
131 |
datetime_undef_if_invalid => 1, |
132 |
is_nullable => 1, |
133 |
}, |
134 |
); |
135 |
|
136 |
=head1 PRIMARY KEY |
137 |
|
138 |
=over 4 |
139 |
|
140 |
=item * L</holding_id> |
141 |
|
142 |
=back |
143 |
|
144 |
=cut |
145 |
|
146 |
__PACKAGE__->set_primary_key("holding_id"); |
147 |
|
148 |
=head1 RELATIONS |
149 |
|
150 |
=head2 biblionumber |
151 |
|
152 |
Type: belongs_to |
153 |
|
154 |
Related object: L<Koha::Schema::Result::Biblio> |
155 |
|
156 |
=cut |
157 |
|
158 |
__PACKAGE__->belongs_to( |
159 |
"biblionumber", |
160 |
"Koha::Schema::Result::Biblio", |
161 |
{ biblionumber => "biblionumber" }, |
162 |
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, |
163 |
); |
164 |
|
165 |
=head2 holdingbranch |
166 |
|
167 |
Type: belongs_to |
168 |
|
169 |
Related object: L<Koha::Schema::Result::Branch> |
170 |
|
171 |
=cut |
172 |
|
173 |
__PACKAGE__->belongs_to( |
174 |
"holdingbranch", |
175 |
"Koha::Schema::Result::Branch", |
176 |
{ branchcode => "holdingbranch" }, |
177 |
{ |
178 |
is_deferrable => 1, |
179 |
join_type => "LEFT", |
180 |
on_delete => "RESTRICT", |
181 |
on_update => "CASCADE", |
182 |
}, |
183 |
); |
184 |
|
185 |
=head2 holdings_metadatas |
186 |
|
187 |
Type: has_many |
188 |
|
189 |
Related object: L<Koha::Schema::Result::HoldingsMetadata> |
190 |
|
191 |
=cut |
192 |
|
193 |
__PACKAGE__->has_many( |
194 |
"holdings_metadatas", |
195 |
"Koha::Schema::Result::HoldingsMetadata", |
196 |
{ "foreign.holding_id" => "self.holding_id" }, |
197 |
{ cascade_copy => 0, cascade_delete => 0 }, |
198 |
); |
199 |
|
200 |
=head2 items |
201 |
|
202 |
Type: has_many |
203 |
|
204 |
Related object: L<Koha::Schema::Result::Item> |
205 |
|
206 |
=cut |
207 |
|
208 |
__PACKAGE__->has_many( |
209 |
"items", |
210 |
"Koha::Schema::Result::Item", |
211 |
{ "foreign.holding_id" => "self.holding_id" }, |
212 |
{ cascade_copy => 0, cascade_delete => 0 }, |
213 |
); |
214 |
|
215 |
|
216 |
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-15 12:37:06 |
217 |
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r5dS7lMIAG11s3PYFp/NKQ |
218 |
|
219 |
=head2 metadata |
220 |
|
221 |
This relationship makes it possible to use metadata as a prefetch table: |
222 |
|
223 |
my $holdings = Koha::Holdings->search({}, {prefetch => 'metadata'}); |
224 |
my $metadata = $holdings->next()->metadata(); |
225 |
|
226 |
=cut |
227 |
|
228 |
__PACKAGE__->has_one( |
229 |
"metadata", |
230 |
"Koha::Schema::Result::HoldingsMetadata", |
231 |
{ "foreign.holding_id" => "self.holding_id" }, |
232 |
{ cascade_copy => 0, cascade_delete => 0 }, |
233 |
); |
234 |
1; |