Bug 18936: (follow-up) Add cloning of circulation rules back to Koha
[koha.git] / Koha / Schema / Result / LibraryGroup.pm
blob6ffb7a8ac4160f7c8960cded2bee22d2e11ffa0f
1 use utf8;
2 package Koha::Schema::Result::LibraryGroup;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
7 =head1 NAME
9 Koha::Schema::Result::LibraryGroup
11 =cut
13 use strict;
14 use warnings;
16 use base 'DBIx::Class::Core';
18 =head1 TABLE: C<library_groups>
20 =cut
22 __PACKAGE__->table("library_groups");
24 =head1 ACCESSORS
26 =head2 id
28 data_type: 'integer'
29 is_auto_increment: 1
30 is_nullable: 0
32 =head2 parent_id
34 data_type: 'integer'
35 is_foreign_key: 1
36 is_nullable: 1
38 =head2 branchcode
40 data_type: 'varchar'
41 is_foreign_key: 1
42 is_nullable: 1
43 size: 10
45 =head2 title
47 data_type: 'varchar'
48 is_nullable: 1
49 size: 100
51 =head2 description
53 data_type: 'mediumtext'
54 is_nullable: 1
56 =head2 ft_hide_patron_info
58 data_type: 'tinyint'
59 default_value: 0
60 is_nullable: 0
62 =head2 ft_search_groups_opac
64 data_type: 'tinyint'
65 default_value: 0
66 is_nullable: 0
68 =head2 ft_search_groups_staff
70 data_type: 'tinyint'
71 default_value: 0
72 is_nullable: 0
74 =head2 ft_local_hold_group
76 data_type: 'tinyint'
77 default_value: 0
78 is_nullable: 0
80 =head2 created_on
82 data_type: 'timestamp'
83 datetime_undef_if_invalid: 1
84 is_nullable: 1
86 =head2 updated_on
88 data_type: 'timestamp'
89 datetime_undef_if_invalid: 1
90 default_value: current_timestamp
91 is_nullable: 0
93 =cut
95 __PACKAGE__->add_columns(
96 "id",
97 { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
98 "parent_id",
99 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
100 "branchcode",
101 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
102 "title",
103 { data_type => "varchar", is_nullable => 1, size => 100 },
104 "description",
105 { data_type => "mediumtext", is_nullable => 1 },
106 "ft_hide_patron_info",
107 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
108 "ft_search_groups_opac",
109 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
110 "ft_search_groups_staff",
111 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
112 "ft_local_hold_group",
113 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
114 "created_on",
116 data_type => "timestamp",
117 datetime_undef_if_invalid => 1,
118 is_nullable => 1,
120 "updated_on",
122 data_type => "timestamp",
123 datetime_undef_if_invalid => 1,
124 default_value => \"current_timestamp",
125 is_nullable => 0,
129 =head1 PRIMARY KEY
131 =over 4
133 =item * L</id>
135 =back
137 =cut
139 __PACKAGE__->set_primary_key("id");
141 =head1 UNIQUE CONSTRAINTS
143 =head2 C<library_groups_uniq_2>
145 =over 4
147 =item * L</parent_id>
149 =item * L</branchcode>
151 =back
153 =cut
155 __PACKAGE__->add_unique_constraint("library_groups_uniq_2", ["parent_id", "branchcode"]);
157 =head2 C<title>
159 =over 4
161 =item * L</title>
163 =back
165 =cut
167 __PACKAGE__->add_unique_constraint("title", ["title"]);
169 =head1 RELATIONS
171 =head2 branchcode
173 Type: belongs_to
175 Related object: L<Koha::Schema::Result::Branch>
177 =cut
179 __PACKAGE__->belongs_to(
180 "branchcode",
181 "Koha::Schema::Result::Branch",
182 { branchcode => "branchcode" },
184 is_deferrable => 1,
185 join_type => "LEFT",
186 on_delete => "CASCADE",
187 on_update => "CASCADE",
191 =head2 library_groups
193 Type: has_many
195 Related object: L<Koha::Schema::Result::LibraryGroup>
197 =cut
199 __PACKAGE__->has_many(
200 "library_groups",
201 "Koha::Schema::Result::LibraryGroup",
202 { "foreign.parent_id" => "self.id" },
203 { cascade_copy => 0, cascade_delete => 0 },
206 =head2 parent
208 Type: belongs_to
210 Related object: L<Koha::Schema::Result::LibraryGroup>
212 =cut
214 __PACKAGE__->belongs_to(
215 "parent",
216 "Koha::Schema::Result::LibraryGroup",
217 { id => "parent_id" },
219 is_deferrable => 1,
220 join_type => "LEFT",
221 on_delete => "CASCADE",
222 on_update => "CASCADE",
227 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-01-30 15:43:39
228 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qg0Ckj0ZBRjSaQgEcvxSZA
230 sub koha_object_class {
231 'Koha::Library::Group';
233 sub koha_objects_class {
234 'Koha::Library::Groups';
237 __PACKAGE__->add_columns(
238 '+ft_hide_patron_info' => { is_boolean => 1 },
239 '+ft_search_groups_opac' => { is_boolean => 1 },
240 '+ft_search_groups_staff' => { is_boolean => 1 },
241 '+ft_local_hold_group' => { is_boolean => 1 },