Hi,
After the (not so elegant) DBIx::Class::Sweet here's another approach
we just discussed in #dbix-class.
"type" defaults to integer(something) and table/class names are
generated using a logic similar to the good old DBIx::Class::Loader.
"One" in the example below would become table "one" and class
"MyApp::Model::DBIC::One" by default.
package MyApp::Model::DBIC;
use strict;
use base 'Catalyst::Model::DBIC::Schema';
use DBIx::Class::Schema::Declare [
One => {
foo => { primary => 1 },
bar => 'text',
}, { table => 'three' },
Two => {
baz => { primary => 1 },
qux => { type => 'text', length => 23, null => 0 },
one => { belongs_to => 'One' }
}
];
1;
For prettier YAML dumps, the following alternative syntax is also
supported.
---
- One
- bar: text
foo:
primary: 1
- table: three
- Two
- baz:
primary: 1
one:
belongs_to: One
qux:
length: 23
null: 0
type: text
--
sebastian
_______________________________________________
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/