]> git.donarmstrong.com Git - debbugs.git/blob - Debbugs/DB/Result/BugStatusCache.pm
26b850e721683c7c0381041671d1abd6e0a335d9
[debbugs.git] / Debbugs / DB / Result / BugStatusCache.pm
1 use utf8;
2 package Debbugs::DB::Result::BugStatusCache;
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::BugStatusCache - Bug Status Cache
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<bug_status_cache>
33
34 =cut
35
36 __PACKAGE__->table("bug_status_cache");
37
38 =head1 ACCESSORS
39
40 =head2 bug
41
42   data_type: 'integer'
43   is_foreign_key: 1
44   is_nullable: 0
45
46 Bug number (matches bug)
47
48 =head2 suite
49
50   data_type: 'integer'
51   is_foreign_key: 1
52   is_nullable: 1
53
54 Suite id (matches suite)
55
56 =head2 arch
57
58   data_type: 'integer'
59   is_foreign_key: 1
60   is_nullable: 1
61
62 Architecture id (matches arch)
63
64 =head2 status
65
66   data_type: 'enum'
67   extra: {custom_type_name => "bug_status_type",list => ["absent","found","fixed","undef"]}
68   is_nullable: 0
69
70 Status (bug status)
71
72 =head2 modified
73
74   data_type: 'timestamp with time zone'
75   default_value: current_timestamp
76   is_nullable: 0
77   original: {default_value => \"now()"}
78
79 Time that this status was last modified
80
81 =head2 asof
82
83   data_type: 'timestamp with time zone'
84   default_value: current_timestamp
85   is_nullable: 0
86   original: {default_value => \"now()"}
87
88 Time that this status was last calculated
89
90 =cut
91
92 __PACKAGE__->add_columns(
93   "bug",
94   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
95   "suite",
96   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
97   "arch",
98   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
99   "status",
100   {
101     data_type => "enum",
102     extra => {
103       custom_type_name => "bug_status_type",
104       list => ["absent", "found", "fixed", "undef"],
105     },
106     is_nullable => 0,
107   },
108   "modified",
109   {
110     data_type     => "timestamp with time zone",
111     default_value => \"current_timestamp",
112     is_nullable   => 0,
113     original      => { default_value => \"now()" },
114   },
115   "asof",
116   {
117     data_type     => "timestamp with time zone",
118     default_value => \"current_timestamp",
119     is_nullable   => 0,
120     original      => { default_value => \"now()" },
121   },
122 );
123
124 =head1 UNIQUE CONSTRAINTS
125
126 =head2 C<bug_status_cache_bug_suite_arch_idx>
127
128 =over 4
129
130 =item * L</bug>
131
132 =item * L</suite>
133
134 =item * L</arch>
135
136 =back
137
138 =cut
139
140 __PACKAGE__->add_unique_constraint(
141   "bug_status_cache_bug_suite_arch_idx",
142   ["bug", "suite", "arch"],
143 );
144
145 =head1 RELATIONS
146
147 =head2 arch
148
149 Type: belongs_to
150
151 Related object: L<Debbugs::DB::Result::Arch>
152
153 =cut
154
155 __PACKAGE__->belongs_to(
156   "arch",
157   "Debbugs::DB::Result::Arch",
158   { id => "arch" },
159   {
160     is_deferrable => 0,
161     join_type     => "LEFT",
162     on_delete     => "CASCADE",
163     on_update     => "CASCADE",
164   },
165 );
166
167 =head2 bug
168
169 Type: belongs_to
170
171 Related object: L<Debbugs::DB::Result::Bug>
172
173 =cut
174
175 __PACKAGE__->belongs_to(
176   "bug",
177   "Debbugs::DB::Result::Bug",
178   { id => "bug" },
179   { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
180 );
181
182 =head2 suite
183
184 Type: belongs_to
185
186 Related object: L<Debbugs::DB::Result::Suite>
187
188 =cut
189
190 __PACKAGE__->belongs_to(
191   "suite",
192   "Debbugs::DB::Result::Suite",
193   { id => "suite" },
194   {
195     is_deferrable => 0,
196     join_type     => "LEFT",
197     on_delete     => "CASCADE",
198     on_update     => "CASCADE",
199   },
200 );
201
202
203 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2017-08-07 09:58:56
204 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RNAken/j2+82FVCyCTnvQw
205
206 sub sqlt_deploy_hook {
207     my ($self, $sqlt_table) = @_;
208 #     $sqlt_table->add_index(name => 'bug_status_cache_bug_suite_arch_idx',
209 #                          fields => ['bug',
210 #                                     q{COALESCE(suite,0)},
211 #                                     q{COALESCE(arch,0)},]
212 #                         );
213     for my $f (qw(bug status arch suite asof)) {
214         $sqlt_table->add_index(name => 'bug_status_cache_idx_'.$f,
215                                fields => [$f],
216                               );
217     }
218 }
219
220 1;