Bug 16735: DBIC Schema files
[srvgit] / 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: 'text'
54   is_nullable: 1
55
56 =head2 created_on
57
58   data_type: 'timestamp'
59   datetime_undef_if_invalid: 1
60   is_nullable: 1
61
62 =head2 updated_on
63
64   data_type: 'timestamp'
65   datetime_undef_if_invalid: 1
66   default_value: current_timestamp
67   is_nullable: 0
68
69 =cut
70
71 __PACKAGE__->add_columns(
72   "id",
73   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
74   "parent_id",
75   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
76   "branchcode",
77   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
78   "title",
79   { data_type => "varchar", is_nullable => 1, size => 100 },
80   "description",
81   { data_type => "text", is_nullable => 1 },
82   "created_on",
83   {
84     data_type => "timestamp",
85     datetime_undef_if_invalid => 1,
86     is_nullable => 1,
87   },
88   "updated_on",
89   {
90     data_type => "timestamp",
91     datetime_undef_if_invalid => 1,
92     default_value => \"current_timestamp",
93     is_nullable => 0,
94   },
95 );
96
97 =head1 PRIMARY KEY
98
99 =over 4
100
101 =item * L</id>
102
103 =back
104
105 =cut
106
107 __PACKAGE__->set_primary_key("id");
108
109 =head1 UNIQUE CONSTRAINTS
110
111 =head2 C<title>
112
113 =over 4
114
115 =item * L</title>
116
117 =back
118
119 =cut
120
121 __PACKAGE__->add_unique_constraint("title", ["title"]);
122
123 =head1 RELATIONS
124
125 =head2 branchcode
126
127 Type: belongs_to
128
129 Related object: L<Koha::Schema::Result::Branch>
130
131 =cut
132
133 __PACKAGE__->belongs_to(
134   "branchcode",
135   "Koha::Schema::Result::Branch",
136   { branchcode => "branchcode" },
137   {
138     is_deferrable => 1,
139     join_type     => "LEFT",
140     on_delete     => "CASCADE",
141     on_update     => "CASCADE",
142   },
143 );
144
145 =head2 library_groups
146
147 Type: has_many
148
149 Related object: L<Koha::Schema::Result::LibraryGroup>
150
151 =cut
152
153 __PACKAGE__->has_many(
154   "library_groups",
155   "Koha::Schema::Result::LibraryGroup",
156   { "foreign.parent_id" => "self.id" },
157   { cascade_copy => 0, cascade_delete => 0 },
158 );
159
160 =head2 parent
161
162 Type: belongs_to
163
164 Related object: L<Koha::Schema::Result::LibraryGroup>
165
166 =cut
167
168 __PACKAGE__->belongs_to(
169   "parent",
170   "Koha::Schema::Result::LibraryGroup",
171   { id => "parent_id" },
172   {
173     is_deferrable => 1,
174     join_type     => "LEFT",
175     on_delete     => "CASCADE",
176     on_update     => "CASCADE",
177   },
178 );
179
180
181 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-09 16:27:08
182 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7JN93utlgFEyQhE9BMx1QQ
183
184
185 # You can replace this text with custom code or comments, and it will be preserved on regeneration
186 1;