has to_version => ( # configuration
is => 'ro',
- lazy_build => 1, # builder comes from another role...
- # which is... probably not how we want it
+ lazy_build => 1,
);
sub _build_to_version { $_[0]->schema->schema_version }
if ($new_version) {
$self->_deploy;
- $self->add_database_version({
+ $self->version_storage->add_database_version({
version => $new_version,
# ddl => $ddl,
# upgrade_sql => $upgrade_sql,
with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage';
sub _build_version_rs {
- $_[0]->schema->set_us_up_the_bomb;
- $_[0]->schema->resultset('__VERSION')
+ $_[0]->schema->register_class(
+ __VERSION =>
+ 'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult'
+ );
+ $_[0]->schema->resultset('__VERSION')
}
sub add_database_version { $_[0]->version_rs->create($_[1]) }
use Carp 'carp';
use DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult;
-sub set_us_up_the_bomb {
- my $self = shift;
-
- $self->register_class(
+sub attach_version_storage {
+ $_[0]->register_class(
__VERSION => 'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult'
);
}
my $self = shift;
$self->next::method(@_);
- $self->set_us_up_the_bomb;
+ $self->attach_version_storage;
my $args = $_[3] || {};
', your database contains version ' . $versions->db_version . ", please call upgrade on your Schema.\n";
}
}
+
return $self;
}