306075b3556d0ab6359223ad38e42b5517120d69
[koha-equinox.git] / Koha / Schema / Result / LibraryGroup.pm
1 use utf8;
2 package Koha::Schema::Result::LibraryGroup;
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::LibraryGroup
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<library_groups>
19
20 =cut
21
22 __PACKAGE__->table("library_groups");
23
24 =head1 ACCESSORS
25
26 =head2 id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 parent_id
33
34   data_type: 'integer'
35   is_foreign_key: 1
36   is_nullable: 1
37
38 =head2 branchcode
39
40   data_type: 'varchar'
41   is_foreign_key: 1
42   is_nullable: 1
43   size: 10
44
45 =head2 title
46
47   data_type: 'varchar'
48   is_nullable: 1
49   size: 100
50
51 =head2 description
52
53   data_type: 'mediumtext'
54   is_nullable: 1
55
56 =head2 ft_hide_patron_info
57
58   data_type: 'tinyint'
59   default_value: 0
60   is_nullable: 0
61
62 =head2 ft_search_groups_opac
63
64   data_type: 'tinyint'
65   default_value: 0
66   is_nullable: 0
67
68 =head2 ft_search_groups_staff
69
70   data_type: 'tinyint'
71   default_value: 0
72   is_nullable: 0
73
74 =head2 created_on
75
76   data_type: 'timestamp'
77   datetime_undef_if_invalid: 1
78   is_nullable: 1
79
80 =head2 updated_on
81
82   data_type: 'timestamp'
83   datetime_undef_if_invalid: 1
84   default_value: current_timestamp
85   is_nullable: 0
86
87 =cut
88
89 __PACKAGE__->add_columns(
90   "id",
91   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
92   "parent_id",
93   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
94   "branchcode",
95   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
96   "title",
97   { data_type => "varchar", is_nullable => 1, size => 100 },
98   "description",
99   { data_type => "mediumtext", is_nullable => 1 },
100   "ft_hide_patron_info",
101   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
102   "ft_search_groups_opac",
103   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
104   "ft_search_groups_staff",
105   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
106   "created_on",
107   {
108     data_type => "timestamp",
109     datetime_undef_if_invalid => 1,
110     is_nullable => 1,
111   },
112   "updated_on",
113   {
114     data_type => "timestamp",
115     datetime_undef_if_invalid => 1,
116     default_value => \"current_timestamp",
117     is_nullable => 0,
118   },
119 );
120
121 =head1 PRIMARY KEY
122
123 =over 4
124
125 =item * L</id>
126
127 =back
128
129 =cut
130
131 __PACKAGE__->set_primary_key("id");
132
133 =head1 UNIQUE CONSTRAINTS
134
135 =head2 C<title>
136
137 =over 4
138
139 =item * L</title>
140
141 =back
142
143 =cut
144
145 __PACKAGE__->add_unique_constraint("title", ["title"]);
146
147 =head1 RELATIONS
148
149 =head2 branchcode
150
151 Type: belongs_to
152
153 Related object: L<Koha::Schema::Result::Branch>
154
155 =cut
156
157 __PACKAGE__->belongs_to(
158   "branchcode",
159   "Koha::Schema::Result::Branch",
160   { branchcode => "branchcode" },
161   {
162     is_deferrable => 1,
163     join_type     => "LEFT",
164     on_delete     => "CASCADE",
165     on_update     => "CASCADE",
166   },
167 );
168
169 =head2 library_groups
170
171 Type: has_many
172
173 Related object: L<Koha::Schema::Result::LibraryGroup>
174
175 =cut
176
177 __PACKAGE__->has_many(
178   "library_groups",
179   "Koha::Schema::Result::LibraryGroup",
180   { "foreign.parent_id" => "self.id" },
181   { cascade_copy => 0, cascade_delete => 0 },
182 );
183
184 =head2 parent
185
186 Type: belongs_to
187
188 Related object: L<Koha::Schema::Result::LibraryGroup>
189
190 =cut
191
192 __PACKAGE__->belongs_to(
193   "parent",
194   "Koha::Schema::Result::LibraryGroup",
195   { id => "parent_id" },
196   {
197     is_deferrable => 1,
198     join_type     => "LEFT",
199     on_delete     => "CASCADE",
200     on_update     => "CASCADE",
201   },
202 );
203
204
205 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54
206 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8hvTh2lWoG/MpfSdq4kx5Q
207
208
209 # You can replace this text with custom code or comments, and it will be preserved on regeneration
210 1;