[Dbix-class] RFC: DBIx::Class::Schema::Declare
Sebastian Riedel
sri at oook.de
Mon Apr 3 20:00:21 CEST 2006
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
More information about the Dbix-class
mailing list