[Dbix-class] RFC: DBIx::Class::Sweet
Matt S Trout
dbix-class at trout.me.uk
Mon Apr 3 16:45:14 CEST 2006
Nilson Santos Figueiredo Junior wrote:
> On 4/3/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
>> Please rather than just releasing pointless tiny modules to CPAN will you
>> consider actually talking to the development teams of the respective packages?
>> There's a large number of DBIx::Class committers and I'd be happy to have you
>> among them, but it'd be much nicer if you collaborated with us and discussed
>> these ideas before you start shipping things to PAUSE.
>
> Well, the thing is: usually my ideas are not that popular.
> Nevertheless, the CPAN is open and I think I may not be the only one
> in the world to like the functionality (albeit tiny).
>
> If you actually liked this idea and think it should be incorporated
> somehow into DBIx::Class, please tell me, because I'd be glad to
> discuss it. This was the reason behind the RFC.
But it wasn't an RFC - an RFC is something you do *before* the fact, not after.
And given we've been in the middle of discussion about improvements to
DBIx::Class, it would have been nice if you'd joined in the discussion first.
I'd quite like to get rid of the classmethod declaration style in favour of
something more elegant, but we need to nail out the syntax first.
What I'd been considering is something more along the lines of
package MySchema;
use base qw/DBIx::Class::Schema/;
use DBIx::Class::Schema::Declare;
setup_schema {
default_components(qw/PK::Auto Core/);
table {
class 'FooBar'; # will set up MySchema::FooBar
name 'foo_bar'; # optional, autosetup if not present
column 'id' => AutoId(); # data_type => 'integer', size => 16,
# is_auto_increment => 1
column 'name' => (String(), Optional(), size => 128);
# String() gives data_type => varchar
# Optional() gives is_nullable => 1
...
};
};
Exactly how relationships are expressed, I'm not sure. I'd quite like to be
able to just say something like (stealing from Mooose.pm)
has 'bazquux' => (isa => 'BazQuux', reverse => 'foobars');
and have that automatically add whatever columns are required to the table and
set up a belongs_to rel (and a has_many 'foobars' on the other side).
Does anybody have any better suggestions/alternative preferences?
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class
mailing list