]> git.donarmstrong.com Git - debbugs.git/blob - Debbugs/DB/Result/SrcVer.pm
switch to compatibility level 12
[debbugs.git] / Debbugs / DB / Result / SrcVer.pm
1 use utf8;
2 package Debbugs::DB::Result::SrcVer;
3
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7 =head1 NAME
8
9 Debbugs::DB::Result::SrcVer - Source Package versions
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 COMPONENTS LOADED
19
20 =over 4
21
22 =item * L<DBIx::Class::InflateColumn::DateTime>
23
24 =item * L<DBIx::Class::TimeStamp>
25
26 =back
27
28 =cut
29
30 __PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
31
32 =head1 TABLE: C<src_ver>
33
34 =cut
35
36 __PACKAGE__->table("src_ver");
37
38 =head1 ACCESSORS
39
40 =head2 id
41
42   data_type: 'integer'
43   is_auto_increment: 1
44   is_nullable: 0
45   sequence: 'src_ver_id_seq'
46
47 Source package version id
48
49 =head2 src_pkg
50
51   data_type: 'integer'
52   is_foreign_key: 1
53   is_nullable: 0
54
55 Source package id (matches src_pkg table)
56
57 =head2 ver
58
59   data_type: 'debversion'
60   is_nullable: 0
61
62 Version of the source package
63
64 =head2 maintainer
65
66   data_type: 'integer'
67   is_foreign_key: 1
68   is_nullable: 1
69
70 Maintainer id (matches maintainer table)
71
72 =head2 upload_date
73
74   data_type: 'timestamp with time zone'
75   default_value: current_timestamp
76   is_nullable: 0
77   original: {default_value => \"now()"}
78
79 Date this version of the source package was uploaded
80
81 =head2 based_on
82
83   data_type: 'integer'
84   is_foreign_key: 1
85   is_nullable: 1
86
87 Source package version this version is based on
88
89 =cut
90
91 __PACKAGE__->add_columns(
92   "id",
93   {
94     data_type         => "integer",
95     is_auto_increment => 1,
96     is_nullable       => 0,
97     sequence          => "src_ver_id_seq",
98   },
99   "src_pkg",
100   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
101   "ver",
102   { data_type => "debversion", is_nullable => 0 },
103   "maintainer",
104   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
105   "upload_date",
106   {
107     data_type     => "timestamp with time zone",
108     default_value => \"current_timestamp",
109     is_nullable   => 0,
110     original      => { default_value => \"now()" },
111   },
112   "based_on",
113   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
114 );
115
116 =head1 PRIMARY KEY
117
118 =over 4
119
120 =item * L</id>
121
122 =back
123
124 =cut
125
126 __PACKAGE__->set_primary_key("id");
127
128 =head1 UNIQUE CONSTRAINTS
129
130 =head2 C<src_ver_src_pkg_id_ver>
131
132 =over 4
133
134 =item * L</src_pkg>
135
136 =item * L</ver>
137
138 =back
139
140 =cut
141
142 __PACKAGE__->add_unique_constraint("src_ver_src_pkg_id_ver", ["src_pkg", "ver"]);
143
144 =head1 RELATIONS
145
146 =head2 based_on
147
148 Type: belongs_to
149
150 Related object: L<Debbugs::DB::Result::SrcVer>
151
152 =cut
153
154 __PACKAGE__->belongs_to(
155   "based_on",
156   "Debbugs::DB::Result::SrcVer",
157   { id => "based_on" },
158   {
159     is_deferrable => 0,
160     join_type     => "LEFT",
161     on_delete     => "CASCADE",
162     on_update     => "CASCADE",
163   },
164 );
165
166 =head2 bin_vers
167
168 Type: has_many
169
170 Related object: L<Debbugs::DB::Result::BinVer>
171
172 =cut
173
174 __PACKAGE__->has_many(
175   "bin_vers",
176   "Debbugs::DB::Result::BinVer",
177   { "foreign.src_ver" => "self.id" },
178   { cascade_copy => 0, cascade_delete => 0 },
179 );
180
181 =head2 bug_vers
182
183 Type: has_many
184
185 Related object: L<Debbugs::DB::Result::BugVer>
186
187 =cut
188
189 __PACKAGE__->has_many(
190   "bug_vers",
191   "Debbugs::DB::Result::BugVer",
192   { "foreign.src_ver" => "self.id" },
193   { cascade_copy => 0, cascade_delete => 0 },
194 );
195
196 =head2 maintainer
197
198 Type: belongs_to
199
200 Related object: L<Debbugs::DB::Result::Maintainer>
201
202 =cut
203
204 __PACKAGE__->belongs_to(
205   "maintainer",
206   "Debbugs::DB::Result::Maintainer",
207   { id => "maintainer" },
208   {
209     is_deferrable => 0,
210     join_type     => "LEFT",
211     on_delete     => "SET NULL",
212     on_update     => "CASCADE",
213   },
214 );
215
216 =head2 src_associations
217
218 Type: has_many
219
220 Related object: L<Debbugs::DB::Result::SrcAssociation>
221
222 =cut
223
224 __PACKAGE__->has_many(
225   "src_associations",
226   "Debbugs::DB::Result::SrcAssociation",
227   { "foreign.source" => "self.id" },
228   { cascade_copy => 0, cascade_delete => 0 },
229 );
230
231 =head2 src_pkg
232
233 Type: belongs_to
234
235 Related object: L<Debbugs::DB::Result::SrcPkg>
236
237 =cut
238
239 __PACKAGE__->belongs_to(
240   "src_pkg",
241   "Debbugs::DB::Result::SrcPkg",
242   { id => "src_pkg" },
243   { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
244 );
245
246 =head2 src_vers
247
248 Type: has_many
249
250 Related object: L<Debbugs::DB::Result::SrcVer>
251
252 =cut
253
254 __PACKAGE__->has_many(
255   "src_vers",
256   "Debbugs::DB::Result::SrcVer",
257   { "foreign.based_on" => "self.id" },
258   { cascade_copy => 0, cascade_delete => 0 },
259 );
260
261
262 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51
263 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gY5LidUaQeuJ5AnN06CfKQ
264
265
266 sub sqlt_deploy_hook {
267     my ($self, $sqlt_table) = @_;
268     $sqlt_table->schema->
269         add_procedure(name => 'src_ver_to_src_pkg',
270                       sql => <<'EOF',
271 CREATE OR REPLACE FUNCTION src_ver_to_src_pkg(src_ver INT) RETURNS INT
272   AS $src_ver_to_src_pkg$
273   DECLARE
274   src_pkg int;
275   BEGIN
276         SELECT sv.src_pkg INTO STRICT src_pkg
277                FROM src_ver sv WHERE sv.id=src_ver;
278         RETURN src_pkg;
279   END
280   $src_ver_to_src_pkg$ LANGUAGE plpgsql;
281 EOF
282                      );
283 }
284 # You can replace this text with custom code or comments, and it will be preserved on regeneration
285 1;