my $apply_role_dbi = sub {
my $self = shift;
- my $class = __PACKAGE__ . '::DBI';
- Class::MOP::load_class($class);
- $class->meta->apply($self);
+ my $role = __PACKAGE__ . '::DBI';
+ Class::MOP::load_class($role);
+ $role->meta->apply($self);
$self->_subclass();
};
- my $apply_role_ddl = sub { };
+ my $apply_role_ddl = sub {
+ my $self = shift;
+ my $role = __PACKAGE__ . '::DDL::' . $self->type;
+ Class::MOP::load_class($role);
+ $role->meta->apply($self);
+ };
has 'dbh' => (
isa => DBIHandle,
trigger => $apply_role_ddl,
);
+ has 'type' => (
+ isa => Str,
+ is => 'ro',
+ );
+
method parse {
my $schema = Schema->new({ name => $self->schema_name });
$self->_add_tables($schema);