Bug 12461 - Add patron clubs feature
[koha.git] / Koha / Schema / Result / Club.pm
1 use utf8;
2 package Koha::Schema::Result::Club;
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::Club
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<clubs>
19
20 =cut
21
22 __PACKAGE__->table("clubs");
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 club_template_id
33
34   data_type: 'integer'
35   is_foreign_key: 1
36   is_nullable: 0
37
38 =head2 name
39
40   data_type: 'tinytext'
41   is_nullable: 0
42
43 =head2 description
44
45   data_type: 'text'
46   is_nullable: 1
47
48 =head2 date_start
49
50   data_type: 'date'
51   datetime_undef_if_invalid: 1
52   is_nullable: 1
53
54 =head2 date_end
55
56   data_type: 'date'
57   datetime_undef_if_invalid: 1
58   is_nullable: 1
59
60 =head2 branchcode
61
62   data_type: 'varchar'
63   is_foreign_key: 1
64   is_nullable: 1
65   size: 10
66
67 =head2 date_created
68
69   data_type: 'timestamp'
70   datetime_undef_if_invalid: 1
71   default_value: current_timestamp
72   is_nullable: 0
73
74 =head2 date_updated
75
76   data_type: 'timestamp'
77   datetime_undef_if_invalid: 1
78   is_nullable: 1
79
80 =cut
81
82 __PACKAGE__->add_columns(
83   "id",
84   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
85   "club_template_id",
86   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
87   "name",
88   { data_type => "tinytext", is_nullable => 0 },
89   "description",
90   { data_type => "text", is_nullable => 1 },
91   "date_start",
92   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
93   "date_end",
94   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
95   "branchcode",
96   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
97   "date_created",
98   {
99     data_type => "timestamp",
100     datetime_undef_if_invalid => 1,
101     default_value => \"current_timestamp",
102     is_nullable => 0,
103   },
104   "date_updated",
105   {
106     data_type => "timestamp",
107     datetime_undef_if_invalid => 1,
108     is_nullable => 1,
109   },
110 );
111
112 =head1 PRIMARY KEY
113
114 =over 4
115
116 =item * L</id>
117
118 =back
119
120 =cut
121
122 __PACKAGE__->set_primary_key("id");
123
124 =head1 RELATIONS
125
126 =head2 branchcode
127
128 Type: belongs_to
129
130 Related object: L<Koha::Schema::Result::Branch>
131
132 =cut
133
134 __PACKAGE__->belongs_to(
135   "branchcode",
136   "Koha::Schema::Result::Branch",
137   { branchcode => "branchcode" },
138   {
139     is_deferrable => 1,
140     join_type     => "LEFT",
141     on_delete     => "RESTRICT",
142     on_update     => "RESTRICT",
143   },
144 );
145
146 =head2 club_enrollments
147
148 Type: has_many
149
150 Related object: L<Koha::Schema::Result::ClubEnrollment>
151
152 =cut
153
154 __PACKAGE__->has_many(
155   "club_enrollments",
156   "Koha::Schema::Result::ClubEnrollment",
157   { "foreign.club_id" => "self.id" },
158   { cascade_copy => 0, cascade_delete => 0 },
159 );
160
161 =head2 club_template
162
163 Type: belongs_to
164
165 Related object: L<Koha::Schema::Result::ClubTemplate>
166
167 =cut
168
169 __PACKAGE__->belongs_to(
170   "club_template",
171   "Koha::Schema::Result::ClubTemplate",
172   { id => "club_template_id" },
173   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
174 );
175
176
177 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-04-26 16:17:25
178 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:H7MVPMvbDxo++sKrggmUyA
179
180
181 # You can replace this text with custom content, and it will be preserved on regeneration
182 1;