lazy_build => 1,
);
-method _build_version_rs {
- $self->schema->set_us_up_the_bomb;
- $self->schema->resultset('__VERSION')
-}
-
has databases => ( # configuration
coerce => 1,
isa => 'DBIx::Class::DeploymentHandler::Databases',
);
method ddl_filename($type, $versions, $dir) {
- my $filename = ref($self->schema);
+ my $filename = ref $self->schema;
$filename =~ s/::/-/g;
$filename = File::Spec->catfile(
}
}
-method create_install_ddl {
+method prepare_install {
my $schema = $self->schema;
my $databases = $self->databases;
my $dir = $self->upgrade_directory;
}
method create_ddl_dir($version, $preversion) {
- $self->create_install_ddl;
+ $self->prepare_install;
$self->create_update_ddl($version, $preversion) if $preversion;
}
handles => [qw{
deployment_statements
deploy
- create_install_ddl
- create_update_ddl
- create_ddl_dir
- upgrade_single_step
+ prepare_install
+ create_update_ddl
+ create_ddl_dir
+ upgrade_single_step
}],
);
sub _build_deploy_method {
- my $self = shift;
- my $args = {
- schema => $self->schema,
- databases => $self->databases,
- upgrade_directory => $self->upgrade_directory,
- sqltargs => $self->sqltargs,
- do_backup => $self->do_backup,
- };
- $args->{backup_directory} = $self->backup_directory
- if $self->has_backup_directory;
- DBIx::Class::DeploymentHandler::SqltDeployMethod->new($args);
+ my $self = shift;
+ my $args = {
+ schema => $self->schema,
+ databases => $self->databases,
+ upgrade_directory => $self->upgrade_directory,
+ sqltargs => $self->sqltargs,
+ do_backup => $self->do_backup,
+ };
+ $args->{backup_directory} = $self->backup_directory
+ if $self->has_backup_directory;
+ DBIx::Class::DeploymentHandler::SqltDeployMethod->new($args);
}
1;
ok($handler, 'DBIx::Class::DeploymentHandler w/1.0 instantiates correctly');
my $version = $s->schema_version();
- $handler->create_install_ddl();
+ $handler->prepare_install();
ok(-e 't/sql/DBICVersion-Schema-1.0-SQLite.sql', 'DDL for 1.0 got created successfully');
dies_ok {
ok($handler, 'DBIx::Class::DeploymentHandler w/2.0 instantiates correctly');
$version = $s->schema_version();
- $handler->create_install_ddl();
+ $handler->prepare_install();
$handler->create_update_ddl($version, '1.0');
ok(-e 't/sql/DBICVersion-Schema-2.0-SQLite.sql', 'DDL for 2.0 got created successfully');
ok(-e 't/sql/DBICVersion-Schema-1.0-2.0-SQLite.sql', 'DDL for migration from 1.0 to 2.0 got created successfully');
ok($handler, 'DBIx::Class::DeploymentHandler w/3.0 instantiates correctly');
$version = $s->schema_version();
- $handler->create_install_ddl;
+ $handler->prepare_install;
$handler->create_update_ddl( $version, '1.0');
$handler->create_update_ddl( $version, '2.0');
ok(-e 't/sql/DBICVersion-Schema-3.0-SQLite.sql', 'DDL for 3.0 got created successfully');
});
my $version = $s->schema_version();
-$handler->create_install_ddl();
+$handler->prepare_install();
$handler->install;
});
my $version = $s->schema_version();
-$handler->create_install_ddl();
+$handler->prepare_install();
$handler->install;
{