root/veekun/trunk/lib/Vee/Schema/Posts.pm @ 350

Revision 350, 0.9 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 
1package Vee::Schema::Posts;
2
3use strict;
4use warnings;
5use base 'DBIx::Class';
6
7=head1 NAME
8
9Vee::Schema::Posts - DBIC class for the C<posts> table
10
11=cut
12
13__PACKAGE__->load_components('Core');
14__PACKAGE__->table('posts');
15__PACKAGE__->add_columns(qw/ id threadid userid flags time format message lasteditid /);
16__PACKAGE__->set_primary_key('id');
17
18__PACKAGE__->belongs_to(thread => 'Vee::Schema::Threads', 'threadid');
19__PACKAGE__->might_have(user => 'Vee::Schema::Users', { 'foreign.id' => 'self.userid' });
20__PACKAGE__->has_many(edits => 'Vee::Schema::Edits', 'postid');
21__PACKAGE__->might_have(lastedit => 'Vee::Schema::Edits', { 'foreign.id' => 'self.lasteditid' });
22
23=head1 SEE ALSO
24
25L<Vee::Schema>, L<DBIx::Class>
26
27=head1 AUTHOR
28
29Maintainer: Alex "Eevee" Munroe (C<veekun@veekun.com>)
30
31See the included F<AUTHORS> file for a full list of contributers.
32
33=head1 LICENSE
34
35See the included F<LICENSE> file.
36
37=cut
38
391;
Note: See TracBrowser for help on using the browser.