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

Revision 350, 1.2 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::EvChains;
2
3use strict;
4use warnings;
5use base 'DBIx::Class';
6
7# NOTE FOR WHEN THIS IS REFACTORED:
8# I *believe* that base is not actually used anywhere except in pokemon_list,
9# but the IDEA is that it is essentially the Pokemon with the LOWEST NATIONAL
10# DEX NUMBER, thus making it the ORIGINAL FORM of the Pokemon.
11# My SOLE EXCEPTION to this is Manaphy, which is the base of its chain, but
12# only because that's not a real chain anyway.
13
14=head1 NAME
15
16Vee::Schema::EvChains - DBIC class for the C<evchains> table
17
18=cut
19
20__PACKAGE__->load_components('Core');
21__PACKAGE__->table('evchains');
22__PACKAGE__->add_columns(qw/
23    id
24    base
25    growth
26    chain
27    steps
28
29    babygs
30    babyc
31    babyrusa
32
33    baby_item
34/);
35__PACKAGE__->set_primary_key('id');
36
37__PACKAGE__->has_many(pokemon => 'Vee::Schema::Pokemon', 'evid');
38# TODO: delete the _pokemon suffix
39__PACKAGE__->belongs_to(base_pokemon => 'Vee::Schema::Pokemon', 'base');
40
41=head1 SEE ALSO
42
43L<Vee::Schema>, L<DBIx::Class>
44
45=head1 AUTHOR
46
47Maintainer: Alex "Eevee" Munroe (C<veekun@veekun.com>)
48
49See the included F<AUTHORS> file for a full list of contributers.
50
51=head1 LICENSE
52
53See the included F<LICENSE> file.
54
55=cut
56
571;
Note: See TracBrowser for help on using the browser.