« blib/lib/CPAN/Testers/Schema/Base.pm
↑ Summary
blib/lib/CPAN/Testers/Schema/Result/MetabaseUser.pm »
| 1 | 15 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | package CPAN::Testers::Schema::Result::LatestIndex; | ||
| 3 | 15 | our $VERSION = '0.025'; | |
| 4 | # ABSTRACT: A cache of the latest version of a dist by author | ||
| 5 | |||
| 6 | #pod =head1 SYNOPSIS | ||
| 7 | #pod | ||
| 8 | #pod my $ix = $schema->resultset( 'LatestIndex' )->find({ | ||
| 9 | #pod dist => 'My-Dist', | ||
| 10 | #pod author => 'PREACTION', | ||
| 11 | #pod }); | ||
| 12 | #pod | ||
| 13 | #pod $schema->resultset( 'LatestIndex' )->find_or_create({ | ||
| 14 | #pod dist => 'My-Dist', | ||
| 15 | #pod author => 'PREACTION', | ||
| 16 | #pod uploadid => 23, | ||
| 17 | #pod version => '1.003', | ||
| 18 | #pod released => 1479410521, | ||
| 19 | #pod oncpan => 1, | ||
| 20 | #pod }); | ||
| 21 | #pod | ||
| 22 | #pod =head1 DESCRIPTION | ||
| 23 | #pod | ||
| 24 | #pod This table stores the latest version of a dist that was uploaded by an | ||
| 25 | #pod author. This information is used to build author pages. | ||
| 26 | #pod | ||
| 27 | #pod This table is a cache of information already found in the C<uploads> | ||
| 28 | #pod table. See L<CPAN::Testers::Schema::Result::Upload>. | ||
| 29 | #pod | ||
| 30 | #pod This data is generated by L<CPAN::Testers::Data::Uploads>. | ||
| 31 | #pod | ||
| 32 | #pod B<XXX>: This table violates 3NF. If we want to continue doing so, we need | ||
| 33 | #pod to have a good reason. Remove this note when we find that reason, or else | ||
| 34 | #pod remove this module/table entirely. | ||
| 35 | #pod | ||
| 36 | #pod =head1 SEE ALSO | ||
| 37 | #pod | ||
| 38 | #pod L<DBIx::Class::Row>, L<CPAN::Testers::Schema>, | ||
| 39 | #pod L<CPAN::Testers::Schema::Result::Upload> | ||
| 40 | #pod | ||
| 41 | #pod =cut | ||
| 42 | |||
| 43 | 15 | ▶ | use CPAN::Testers::Schema::Base 'Result'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 44 | |||
| 45 | 15 | table 'ixlatest'; | |
| 46 | |||
| 47 | #pod =attr dist | ||
| 48 | #pod | ||
| 49 | #pod The distribution name. Composite primary key with L</author>. Copied | ||
| 50 | #pod from the `dist` column of the `uploads` table. | ||
| 51 | #pod | ||
| 52 | #pod =cut | ||
| 53 | |||
| 54 | 15 | column dist => { | |
| 55 | data_type => 'varchar', | ||
| 56 | is_nullable => 0, | ||
| 57 | }; | ||
| 58 | |||
| 59 | #pod =attr author | ||
| 60 | #pod | ||
| 61 | #pod The distribution author. Composite primary key with L</dist>. Copied | ||
| 62 | #pod from the `author` column of the `uploads` table. | ||
| 63 | #pod | ||
| 64 | #pod =cut | ||
| 65 | |||
| 66 | 15 | column author => { | |
| 67 | data_type => 'varchar', | ||
| 68 | is_nullable => 0, | ||
| 69 | }; | ||
| 70 | |||
| 71 | 15 | primary_key qw( dist author ); | |
| 72 | |||
| 73 | #pod =attr version | ||
| 74 | #pod | ||
| 75 | #pod The version of the distribution release. Copied from the `version` column | ||
| 76 | #pod of the `uploads` table. | ||
| 77 | #pod | ||
| 78 | #pod =cut | ||
| 79 | |||
| 80 | 15 | column version => { | |
| 81 | data_type => 'varchar', | ||
| 82 | is_nullable => 0, | ||
| 83 | }; | ||
| 84 | |||
| 85 | #pod =attr released | ||
| 86 | #pod | ||
| 87 | #pod The UNIX epoch of the release. Copied from the `released` column of the | ||
| 88 | #pod `uploads` table. | ||
| 89 | #pod | ||
| 90 | #pod =cut | ||
| 91 | |||
| 92 | 15 | column released => { | |
| 93 | data_type => 'bigint', | ||
| 94 | is_nullable => 0, | ||
| 95 | }; | ||
| 96 | |||
| 97 | #pod =attr oncpan | ||
| 98 | #pod | ||
| 99 | #pod An integer deciding whether this release is on CPAN. If C<0>, this | ||
| 100 | #pod release is not available on CPAN. If C<1>, this release is available on | ||
| 101 | #pod CPAN or was reported by the CPAN upload notification system (`cpan` or | ||
| 102 | #pod `upload` value in the `type` column on the `uploads` table). If C<2>, | ||
| 103 | #pod this release is available on BackPAN. | ||
| 104 | #pod | ||
| 105 | #pod =cut | ||
| 106 | |||
| 107 | 15 | column oncpan => { | |
| 108 | data_type => 'int', | ||
| 109 | is_nullable => 0, | ||
| 110 | }; | ||
| 111 | |||
| 112 | #pod =attr uploadid | ||
| 113 | #pod | ||
| 114 | #pod The ID of this upload from the `uploads` table. | ||
| 115 | #pod | ||
| 116 | #pod =cut | ||
| 117 | |||
| 118 | 15 | column uploadid => { | |
| 119 | data_type => 'int', | ||
| 120 | extra => { unsigned => 1 }, | ||
| 121 | is_nullable => 0, | ||
| 122 | }; | ||
| 123 | |||
| 124 | #pod =method upload | ||
| 125 | #pod | ||
| 126 | #pod Get the related row from the `uploads` table. See | ||
| 127 | #pod L<CPAN::Testers::Schema::Result::Upload>. | ||
| 128 | #pod | ||
| 129 | #pod =cut | ||
| 130 | |||
| 131 | 15 | belongs_to upload => 'CPAN::Testers::Schema::Result::Upload' => 'uploadid'; | |
| 132 | |||
| 133 | 15 | 1; | |
| 134 | |||
| 135 | __END__ | ||
| 136 | |||
| 137 | =pod | ||
| 138 | |||
| 139 | =head1 NAME | ||
| 140 | |||
| 141 | CPAN::Testers::Schema::Result::LatestIndex - A cache of the latest version of a dist by author | ||
| 142 | |||
| 143 | =head1 VERSION | ||
| 144 | |||
| 145 | version 0.025 | ||
| 146 | |||
| 147 | =head1 SYNOPSIS | ||
| 148 | |||
| 149 | my $ix = $schema->resultset( 'LatestIndex' )->find({ | ||
| 150 | dist => 'My-Dist', | ||
| 151 | author => 'PREACTION', | ||
| 152 | }); | ||
| 153 | |||
| 154 | $schema->resultset( 'LatestIndex' )->find_or_create({ | ||
| 155 | dist => 'My-Dist', | ||
| 156 | author => 'PREACTION', | ||
| 157 | uploadid => 23, | ||
| 158 | version => '1.003', | ||
| 159 | released => 1479410521, | ||
| 160 | oncpan => 1, | ||
| 161 | }); | ||
| 162 | |||
| 163 | =head1 DESCRIPTION | ||
| 164 | |||
| 165 | This table stores the latest version of a dist that was uploaded by an | ||
| 166 | author. This information is used to build author pages. | ||
| 167 | |||
| 168 | This table is a cache of information already found in the C<uploads> | ||
| 169 | table. See L<CPAN::Testers::Schema::Result::Upload>. | ||
| 170 | |||
| 171 | This data is generated by L<CPAN::Testers::Data::Uploads>. | ||
| 172 | |||
| 173 | B<XXX>: This table violates 3NF. If we want to continue doing so, we need | ||
| 174 | to have a good reason. Remove this note when we find that reason, or else | ||
| 175 | remove this module/table entirely. | ||
| 176 | |||
| 177 | =head1 ATTRIBUTES | ||
| 178 | |||
| 179 | =head2 dist | ||
| 180 | |||
| 181 | The distribution name. Composite primary key with L</author>. Copied | ||
| 182 | from the `dist` column of the `uploads` table. | ||
| 183 | |||
| 184 | =head2 author | ||
| 185 | |||
| 186 | The distribution author. Composite primary key with L</dist>. Copied | ||
| 187 | from the `author` column of the `uploads` table. | ||
| 188 | |||
| 189 | =head2 version | ||
| 190 | |||
| 191 | The version of the distribution release. Copied from the `version` column | ||
| 192 | of the `uploads` table. | ||
| 193 | |||
| 194 | =head2 released | ||
| 195 | |||
| 196 | The UNIX epoch of the release. Copied from the `released` column of the | ||
| 197 | `uploads` table. | ||
| 198 | |||
| 199 | =head2 oncpan | ||
| 200 | |||
| 201 | An integer deciding whether this release is on CPAN. If C<0>, this | ||
| 202 | release is not available on CPAN. If C<1>, this release is available on | ||
| 203 | CPAN or was reported by the CPAN upload notification system (`cpan` or | ||
| 204 | `upload` value in the `type` column on the `uploads` table). If C<2>, | ||
| 205 | this release is available on BackPAN. | ||
| 206 | |||
| 207 | =head2 uploadid | ||
| 208 | |||
| 209 | The ID of this upload from the `uploads` table. | ||
| 210 | |||
| 211 | =head1 METHODS | ||
| 212 | |||
| 213 | =head2 upload | ||
| 214 | |||
| 215 | Get the related row from the `uploads` table. See | ||
| 216 | L<CPAN::Testers::Schema::Result::Upload>. | ||
| 217 | |||
| 218 | =head1 SEE ALSO | ||
| 219 | |||
| 220 | L<DBIx::Class::Row>, L<CPAN::Testers::Schema>, | ||
| 221 | L<CPAN::Testers::Schema::Result::Upload> | ||
| 222 | |||
| 223 | =head1 AUTHORS | ||
| 224 | |||
| 225 | =over 4 | ||
| 226 | |||
| 227 | =item * | ||
| 228 | |||
| 229 | Oriol Soriano <oriolsoriano@gmail.com> | ||
| 230 | |||
| 231 | =item * | ||
| 232 | |||
| 233 | Doug Bell <preaction@cpan.org> | ||
| 234 | |||
| 235 | =back | ||
| 236 | |||
| 237 | =head1 COPYRIGHT AND LICENSE | ||
| 238 | |||
| 239 | This software is copyright (c) 2018 by Oriol Soriano, Doug Bell. | ||
| 240 | |||
| 241 | This is free software; you can redistribute it and/or modify it under | ||
| 242 | the same terms as the Perl 5 programming language system itself. | ||
| 243 | |||
| 244 | =cut | ||