Show
Ignore:
Timestamp:
10/23/07 01:30:10 (14 months ago)
Author:
eevee
Message:

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)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • veekun/trunk/lib/Vee/Schema/Edits.pm

    r31 r350  
    11package Vee::Schema::Edits; 
    2  
    3 # Created by DBIx::Class::Schema::Loader v0.03003 @ 2006-07-11 01:54:10 
    42 
    53use strict; 
    64use warnings; 
    7  
    85use base 'DBIx::Class'; 
    96 
    10 __PACKAGE__->load_components("PK::Auto", "Core"); 
    11 __PACKAGE__->table("edits"); 
    12 __PACKAGE__->add_columns("id", "postid", "userid", "time", "oldmessage"); 
    13 __PACKAGE__->set_primary_key("id"); 
    14 __PACKAGE__->add_unique_constraint(["id"], undef); 
     7=head1 NAME 
    158 
    16 #__PACKAGE__->belongs_to(post => 'Vee::Schema::Posts', 'postid'); 
    17 #__PACKAGE__->belongs_to(user => 'Vee::Schema::Users', 'userid'); 
    18 # have to use might_have because more often than not there is no edit row for a post and that fucks everything up 
     9Vee::Schema::Edits - DBIC class for the C<edits> table 
     10 
     11=cut 
     12 
     13__PACKAGE__->load_components('Core'); 
     14__PACKAGE__->table('edits'); 
     15__PACKAGE__->add_columns(qw/ id postid userid time oldmessage /); 
     16__PACKAGE__->set_primary_key('id'); 
    1917 
    2018__PACKAGE__->might_have(post => 'Vee::Schema::Posts', { 'foreign.id' => 'self.postid' }); 
    2119__PACKAGE__->might_have(user => 'Vee::Schema::Users', { 'foreign.id' => 'self.userid' }); 
    2220 
     21=head1 SEE ALSO 
     22 
     23L<Vee::Schema>, L<DBIx::Class> 
     24 
     25=head1 AUTHOR 
     26 
     27Maintainer: Alex "Eevee" Munroe (C<veekun@veekun.com>) 
     28 
     29See the included F<AUTHORS> file for a full list of contributers. 
     30 
     31=head1 LICENSE 
     32 
     33See the included F<LICENSE> file. 
     34 
     35=cut 
     36 
    23371; 
    24