Hi.
I just added __PACKAGE__->sequence() calls to my DBIx:Class classes¹.
It went fine until I reached this one (cut-down example):
package MyDB::Artist;
use strict;
use warnings;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto Core/);
__PACKAGE__->table('music.artist');
__PACKAGE__->add_columns(qw/id sequence created updated/);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->sequence('music.artist_full_id_seq');
__PACKAGE__->has_many('albums', 'MyDB::Album', 'artist_id');
>From which I got an incomprehensible error-message along the lines of:
DBIx::Class::Schema::load_classes():
DBIx::Class::Relationship::BelongsTo::belongs_to():
DBIx::Class::Relationship::HasMany::has_many():
DBIx::Class::Relationship::BelongsTo::belongs_to(): Can't locate object method
"segments" via package "MyDB::Album" at lib/MyDB/Album.pm line 314.
After staring a little at it, I got a hunch and moved the ->sequence
call up before the __PACKAGE__->add_columns one - and the error went
away.
I'm wondering whether this interaction is a bug, or if I should just
learn to do these things in the "correct" order...?
Mvh.
Adam
¹ Because they are (now) views, so the auto-detection does not work
(for good reasons, I think), but that is another story :-)
--
Adam Sjøgren
[EMAIL PROTECTED]
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/