|
Revision 350, 0.8 KB
(checked in by eevee, 2 years ago)
|
|
I discovered that DBIx::Class::Schema::Loader had been filling my table classes with lines of the form __PACKAGE__->add_unique_constraint(['id'], undef); erroneously, due to someone's inadvertently iterating over %hash rather than keys %hash. Not only were these lines redundant in the case of a primary key, but the parameters are supposed to be a name and a list of columns: thus I had a lot of constraints with ARRAY(0x...) as names and no columns. This was thoroughly breaking $schema->deploy, as it was trying to create indices with garbage names that looked like functions. I have, obviously, removed them all.
In the process, I have done something I've been meaning to do for a while: cleaned up the source in every single file to match my usual style. No auto-gen comment, no redundant loading of PK::Auto, no double-newline after the 1;, proper POD, use of qw// for passing lists, etc. This is actually a teeny part of my db cleanup tracking bug. (#58)
|
| Line | |
|---|
| 1 | package Vee::Schema::Gallery; |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use warnings; |
|---|
| 5 | use base 'DBIx::Class'; |
|---|
| 6 | |
|---|
| 7 | =head1 NAME |
|---|
| 8 | |
|---|
| 9 | Vee::Schema::Gallery - DBIC class for the C<gallery> table |
|---|
| 10 | |
|---|
| 11 | =cut |
|---|
| 12 | |
|---|
| 13 | __PACKAGE__->load_components('Core'); |
|---|
| 14 | __PACKAGE__->table('gallery'); |
|---|
| 15 | __PACKAGE__->add_columns(qw/ |
|---|
| 16 | id |
|---|
| 17 | creatorid |
|---|
| 18 | filename |
|---|
| 19 | uploaderid |
|---|
| 20 | approverid |
|---|
| 21 | time |
|---|
| 22 | hash |
|---|
| 23 | title |
|---|
| 24 | description |
|---|
| 25 | height |
|---|
| 26 | width |
|---|
| 27 | seriesid |
|---|
| 28 | position |
|---|
| 29 | type |
|---|
| 30 | /); |
|---|
| 31 | __PACKAGE__->set_primary_key('id'); |
|---|
| 32 | __PACKAGE__->add_unique_constraint(filename => ['filename']); |
|---|
| 33 | |
|---|
| 34 | =head1 SEE ALSO |
|---|
| 35 | |
|---|
| 36 | L<Vee::Schema>, L<DBIx::Class> |
|---|
| 37 | |
|---|
| 38 | =head1 AUTHOR |
|---|
| 39 | |
|---|
| 40 | Maintainer: Alex "Eevee" Munroe (C<veekun@veekun.com>) |
|---|
| 41 | |
|---|
| 42 | See the included F<AUTHORS> file for a full list of contributers. |
|---|
| 43 | |
|---|
| 44 | =head1 LICENSE |
|---|
| 45 | |
|---|
| 46 | See the included F<LICENSE> file. |
|---|
| 47 | |
|---|
| 48 | =cut |
|---|
| 49 | |
|---|
| 50 | 1; |
|---|