handles => [qw( schema_version )],
);
-has version_rs => (
- isa => 'DBIx::Class::ResultSet',
+has version_storage => (
+ does => 'DBIx::Class::DeploymentHandler::HandlesVersionStorage',
is => 'ro',
- lazy_build => 1,
- handles => [qw( is_installed db_version )],
+ required => 1,
+ handles => 'DBIx::Class::DeploymentHandler::HandlesVersionStorage',
);
-sub _build_version_rs {
- $_[0]->schema->set_us_up_the_bomb;
- $_[0]->schema->resultset('__VERSION')
-}
-
has to_version => (
is => 'ro',
lazy_build => 1,
$self->once(!$self->once);
return undef
- if $self->db_version eq $self->to_version;
- return [$self->db_version, $self->to_version];
+ if $self->database_version eq $self->to_version;
+ return [$self->database_version, $self->to_version];
}
required => 1,
trigger => sub {
my $to_version = $_[0]->to_version;
- my $db_version = $_[0]->db_version;
+ my $db_version = $_[0]->database_version;
croak 'to_version not in ordered_versions'
unless grep { $to_version eq $_ } @{ $_[1] };
method _inc_version_idx { $self->_version_idx($self->_version_idx + 1 ) }
method _build__version_idx {
- my $start = $self->version_rs->db_version;
+ my $start = $self->database_version;
my $idx = 0;
for (@{$self->ordered_versions}) {
return $idx
- if $_ eq $self->db_version;
+ if $_ eq $self->database_version;
$idx++;
}
croak 'database version not found in ordered_versions!';
my $self = shift;
my $args = {
- schema => $self->schema,
+ schema => $self->schema,
+ version_storage => $self->version_storage,
};
$args->{to_version} = $self->to_version if $self->has_to_version;
upgrade_directory => $sql_dir,
schema => $s,
databases => 'SQLite',
- sqltargs => { add_drop_table => 0 },
+ sqltargs => { add_drop_table => 0 },
});
+my $v_storage = $handler->version_storage;
+
my $version = $s->schema_version();
$handler->prepare_install();
schema => $s,
ordered_versions => $versions,
to_version => '1.0',
+ version_storage => $v_storage,
});
ok $vh, 'VersionHandler gets instantiated';
schema => $s,
ordered_versions => $versions,
to_version => '5.0',
+ version_storage => $v_storage,
});
ok $vh, 'VersionHandler gets instantiated';
schema => $s,
ordered_versions => $versions,
to_version => '0.0',
+ version_storage => $v_storage,
});
} 'cannot request a version before the current version';
databases => 'SQLite',
sqltargs => { add_drop_table => 0 },
});
-
+my $v_storage = $handler->version_storage;
my $version = $s->schema_version();
$handler->prepare_install();
schema => $s,
ordered_versions => $versions,
to_version => '5.0',
+ version_storage => $v_storage,
});
ok( $vh, 'VersionHandler gets instantiated' );
my $vh = DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions->new({
schema => $s,
ordered_versions => $versions,
+ version_storage => $v_storage,
});
ok( $vh, 'VersionHandler gets instantiated' );
my $vh = DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions->new({
schema => $s,
ordered_versions => $versions,
+ version_storage => $v_storage,
});
ok( $vh, 'VersionHandler gets instantiated' );
my $vh = DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions->new({
schema => $s,
ordered_versions => $versions,
+ version_storage => $v_storage,
});
ok( $vh, 'VersionHandler gets instantiated' );