extends 'DBIx::Class::DeploymentHandler::Dad';
# 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::Deprecated::WithDeprecatedSqltDeployMethod',
- 'DBIx::Class::DeploymentHandler::Deprecated::WithDeprecatedVersionStorage';
+with 'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
+ interface_role => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
+ class_name => 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated',
+ delegate_name => 'deploy_method',
+ attributes_to_assume => ['schema'],
+ attributes_to_copy => [qw( upgrade_directory databases sql_translator_args )],
+ },
+ 'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
+ interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersionStorage',
+ class_name => 'DBIx::Class::DeploymentHandler::VersionStorage::Deprecated',
+ delegate_name => 'version_storage',
+ attributes_to_assume => ['schema'],
+ };
with 'DBIx::Class::DeploymentHandler::WithReasonableDefaults';
sub BUILD {
if ($self->schema->can('ordered_versions') && $self->schema->ordered_versions) {
apply_all_roles(
$self,
- 'DBIx::Class::DeploymentHandler::WithExplicitVersions'
+ 'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
+ interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
+ class_name => 'DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions',
+ delegate_name => 'version_handler',
+ attributes_to_assume => [qw( database_version schema_version to_version )],
+ }
);
} else {
apply_all_roles(
$self,
- 'DBIx::Class::DeploymentHandler::WithDatabaseToSchemaVersions'
+ 'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
+ interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
+ class_name => 'DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions',
+ delegate_name => 'version_handler',
+ attributes_to_assume => [qw( database_version schema_version to_version )],
+ }
);
}
+ # the following is just a hack so that ->version_storage
+ # won't be lazy
+ $self->version_storage;
}
__PACKAGE__->meta->make_immutable;
+++ /dev/null
-package DBIx::Class::DeploymentHandler::Deprecated::WithDeprecatedSqltDeployMethod;
-use Moose::Role;
-
-# ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
-
-use DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated;
-
-has deploy_method => (
- does => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
- is => 'ro',
- lazy_build => 1,
- handles => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
-);
-
-has upgrade_directory => (
- isa => 'Str',
- is => 'ro',
- required => 1,
- default => 'sql',
-);
-
-has databases => (
- coerce => 1,
- isa => 'DBIx::Class::DeploymentHandler::Databases',
- is => 'ro',
- default => sub { [qw( MySQL SQLite PostgreSQL )] },
-);
-
-has sql_translator_args => (
- isa => 'HashRef',
- is => 'ro',
- default => sub { {} },
-);
-
-sub _build_deploy_method {
- my $self = shift;
- DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated->new({
- schema => $self->schema,
- databases => $self->databases,
- upgrade_directory => $self->upgrade_directory,
- sql_translator_args => $self->sql_translator_args,
- });
-}
-
-1;
-
-# vim: ts=2 sw=2 expandtab
-
-__END__
-
-=head1 DEPRECATED
-
-This component has been suplanted by
-L<DBIx::Class::DeploymentHandler::WithSqltDeployMethod>.
-In the next major version (1) we will begin issuing a warning on it's use.
-In the major version after that (2) we will remove it entirely.
-
-=head1 DELEGATION ROLE
-
-This role is entirely for making delegation look like a role. The actual
-docs for the methods and attributes are at
-L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated>
+++ /dev/null
-package DBIx::Class::DeploymentHandler::Deprecated::WithDeprecatedVersionStorage;
-use Moose::Role;
-
-# ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
-
-use DBIx::Class::DeploymentHandler::VersionStorage::Deprecated;
-
-has version_storage => (
- does => 'DBIx::Class::DeploymentHandler::HandlesVersionStorage',
- is => 'ro',
- builder => '_build_version_storage',
- handles => 'DBIx::Class::DeploymentHandler::HandlesVersionStorage',
-);
-
-sub _build_version_storage {
- DBIx::Class::DeploymentHandler::VersionStorage::Deprecated
- ->new({ schema => $_[0]->schema });
-}
-
-1;
-
-# vim: ts=2 sw=2 expandtab
-
-__END__
-
-=head1 DEPRECATED
-
-This component has been suplanted by
-L<DBIx::Class::DeploymentHandler::WithStandardVersionStorage>.
-In the next major version (1) we will begin issuing a warning on it's use.
-In the major version after that (2) we will remove it entirely.
-
-=head1 DELEGATION ROLE
-
-This role is entirely for making delegation look like a role. The actual
-docs for the methods and attributes are at
-L<DBIx::Class::DeploymentHandler::VersionStorage::Deprecated>
use Class::MOP;
use namespace::autoclean;
+# this is at least a little ghetto and not super well
+# thought out. Take a look at the following at some
+# point to clean it all up:
+#
+# http://search.cpan.org/~jjnapiork/MooseX-Role-BuildInstanceOf-0.06/lib/MooseX/Role/BuildInstanceOf.pm
+# http://github.com/rjbs/role-subsystem/blob/master/lib/Role/Subsystem.pm
+
parameter interface_role => (
isa => 'Str',
required => 1,
my $meta = Class::MOP::class_of($class_name);
has $_->name => %{ $_->clone }
- for grep { $_ } map $meta->get_attribute($_), @{ $p->attributes_to_copy };
+ for grep { $_ } map $meta->find_attribute_by_name($_), @{ $p->attributes_to_copy };
has $p->delegate_name => (
is => 'ro',
+++ /dev/null
-package DBIx::Class::DeploymentHandler::WithDatabaseToSchemaVersions;
-use Moose::Role;
-
-# ABSTRACT: Delegate/Role for DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions
-
-use DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions;
-
-use Carp 'carp';
-
-has version_handler => (
- is => 'ro',
- lazy_build => 1,
- does => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
- handles => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
-);
-
-sub _build_version_handler {
- my $self = shift;
-
- my $args = {
- database_version => $self->database_version,
- schema_version => $self->schema_version,
- };
-
- $args->{to_version} = $self->to_version if $self->has_to_version;
- DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions->new($args);
-}
-
-1;
-
-# vim: ts=2 sw=2 expandtab
-
-__END__
-
-=head1 DELEGATION ROLE
-
-This role is entirely for making delegation look like a role. The actual
-docs for the methods and attributes are at
-L<DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions>
+++ /dev/null
-package DBIx::Class::DeploymentHandler::WithExplicitVersions;
-use Moose::Role;
-
-# ABSTRACT: Delegate/Role for DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions
-
-use DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions;
-
-use Carp 'carp';
-
-has version_handler => (
- is => 'ro',
- lazy_build => 1,
- does => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
- handles => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
-);
-
-sub _build_version_handler {
- my $self = shift;
-
- my $args = {
- database_version => $self->database_version,
- schema_version => $self->schema_version,
- };
-
- $args->{to_version} = $self->to_version if $self->has_to_version;
- DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions->new($args);
-}
-
-1;
-
-# vim: ts=2 sw=2 expandtab
-
-__END__
-
-=head1 DELEGATION ROLE
-
-This role is entirely for making delegation look like a role. The actual
-docs for the methods and attributes are at
-L<DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions>
+++ /dev/null
-package DBIx::Class::DeploymentHandler::WithSqltDeployMethod;
-use Moose::Role;
-
-# ABSTRACT: Delegate/Role for DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator
-
-use DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator;
-
-has deploy_method => (
- does => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
- is => 'ro',
- lazy_build => 1,
- handles => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
-);
-
-has upgrade_directory => (
- isa => 'Str',
- is => 'ro',
- required => 1,
- default => 'sql',
-);
-
-has databases => (
- coerce => 1,
- isa => 'DBIx::Class::DeploymentHandler::Databases',
- is => 'ro',
- default => sub { [qw( MySQL SQLite PostgreSQL )] },
-);
-
-has sql_translator_args => (
- isa => 'HashRef',
- is => 'ro',
- default => sub { {} },
-);
-
-sub _build_deploy_method {
- my $self = shift;
- my $args = {
- schema => $self->schema,
- databases => $self->databases,
- upgrade_directory => $self->upgrade_directory,
- sql_translator_args => $self->sql_translator_args,
- };
-
- $args->{schema_version} = $self->schema_version if $self->has_schema_version;
- DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator->new($args);
-}
-
-1;
-
-# vim: ts=2 sw=2 expandtab
-
-__END__
-
-=head1 DELEGATION ROLE
-
-This role is entirely for making delegation look like a role. The actual
-docs for the methods and attributes are at
-L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator>