}
}
-method upgrade {
- while ( my $version_list = $self->next_version_set ) {
- $self->_upgrade_single_step($version_list);
+sub upgrade {
+ while ( my $version_list = $_[0]->next_version_set ) {
+ $_[0]->_upgrade_single_step($version_list);
}
}
require SQL::Translator::Diff;
require DBIx::Class::Storage; # loaded for type constraint
+with 'DBIx::Class::DeploymentHandler::HandlesDeploy';
use Carp 'carp';
has storage => (
return $wa ? @ret : $ret[0];
}
-method _deploy {
+sub _deploy {
+ my $self = shift;
my $storage = $self->storage;
my $deploy = sub {
}
}
-method prepare_install {
+sub prepare_install {
+ my $self = shift;
my $schema = $self->schema;
my $databases = $self->databases;
my $dir = $self->upgrade_directory;
}
}
-method prepare_update($version, $preversion) {
+sub prepare_update {
+ my ($self, $version, $preversion) = @_;
my $schema = $self->schema;
my $databases = $self->databases;
my $dir = $self->upgrade_directory;
return \@data;
}
-method _upgrade_single_step {
+sub _upgrade_single_step {
+ my $self = shift;
my @version_set = @{ shift @_ };
my $db_version = $self->db_version;
my $upgrade_file = $self->_ddl_filename(
--- /dev/null
+package DBIx::Class::DeploymentHandler::HandlesDeploy;
+use Moose::Role;
+
+requires 'prepare_install';
+requires 'prepare_update';
+requires '_upgrade_single_step';
+requires '_deploy';
+
+1;
+
+__END__
+
+vim: ts=2 sw=2 expandtab
use DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator;
has deploy_method => (
-
-# < mst> isa => 'DBIx::Class::DeploymentHandler::SqltDeployMethod',
-# < mst> should be
-# < mst> does => <some role>
-# < mst> and that role should supply those methods
-# < mst> then you can pass handles => <some role> as well
-
- isa => 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator',
+ does => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
is => 'ro',
lazy_build => 1,
- handles => [qw{
- _deploy
- prepare_install
- prepare_update
- _upgrade_single_step
- }],
+ handles => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
);
sub _build_deploy_method {