# a single with would be better, but we can't do that
# see: http://rt.cpan.org/Public/Bug/Display.html?id=46347
with 'DBIx::Class::DeploymentHandler::WithSqltDeployMethod',
- 'DBIx::Class::DeploymentHandler::WithMonotonicVersions',
- 'DBIx::Class::DeploymentHandler::WithStandardVersionStorage';
+ #'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
+ #interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersionStorage',
+ #class_name => 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator',
+ #delegate_name => 'deploy_method',
+ #attributes_to_assume => ['schema'],
+ #attributes_to_copy => [qw( databases upgrade_directory sql_translator_args )],
+ #},
+ 'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
+ interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
+ class_name => 'DBIx::Class::DeploymentHandler::VersionHandler::Monotonic',
+ delegate_name => 'version_handler',
+ attributes_to_assume => [qw( database_version schema_version to_version )],
+ },
+ 'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
+ interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersionStorage',
+ class_name => 'DBIx::Class::DeploymentHandler::VersionStorage::Standard',
+ delegate_name => 'version_storage',
+ attributes_to_assume => ['schema'],
+ };
with 'DBIx::Class::DeploymentHandler::WithReasonableDefaults';
sub prepare_version_storage_install {
--- /dev/null
+package DBIx::Class::DeploymentHandler::WithApplicatorDumple;
+use MooseX::Role::Parameterized;
+use Class::MOP;
+use namespace::autoclean;
+
+parameter interface_role => (
+ isa => 'Str',
+ required => 1,
+);
+
+parameter class_name => (
+ isa => 'Str',
+ required => 1,
+);
+
+parameter delegate_name => (
+ isa => 'Str',
+ required => 1,
+);
+
+parameter interface_role => (
+ isa => 'Str',
+ required => 1,
+);
+
+parameter attributes_to_copy => (
+ isa => 'ArrayRef[Str]',
+ default => sub {[]},
+);
+
+parameter attributes_to_assume => (
+ isa => 'ArrayRef[Str]',
+ default => sub {[]},
+);
+
+role {
+ my $p = shift;
+
+ my $class_name = $p->class_name;
+
+ Class::MOP::load_class($class_name);
+
+ my $meta = Class::MOP::class_of($class_name);
+
+ has [map %{$_->clone}, map $meta->get_attribute($_), @{ $p->attributes_to_copy }];
+
+ has $p->delegate_name => (
+ is => 'ro',
+ lazy_build => 1,
+ does => $p->interface_role,
+ handles => $p->interface_role,
+ );
+
+ method '_build_'.$p->delegate_name => sub {
+ my $self = shift;
+
+ $class_name->new({
+ map { $_ => $self->$_ }
+ @{ $p->attributes_to_assume },
+ @{ $p->attributes_to_copy },
+ })
+ };
+};
+
+1;
+
+# vim: ts=2 sw=2 expandtab
+
+__END__