require DBIx::Class::ResultSet; # loaded for type constraint
use Carp::Clan '^DBIx::Class::DeploymentHandler';
+use DBIx::Class::DeploymentHandler::Types;
with 'DBIx::Class::DeploymentHandler::WithSqltDeployMethod',
'DBIx::Class::DeploymentHandler::WithDatabaseToSchemaVersions',
'DBIx::Class::DeploymentHandler::WithStandardVersionStorage';
-BEGIN {
- use Moose::Util::TypeConstraints;
- subtype 'DBIx::Class::DeploymentHandler::Databases'
- => as 'ArrayRef[Str]';
-
- coerce 'DBIx::Class::DeploymentHandler::Databases'
- => from 'Str'
- => via { [$_] };
- no Moose::Util::TypeConstraints;
-}
has schema => (
isa => 'DBIx::Class::Schema',
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 }
);
method install {
- carp 'Install not possible as versions table already exists in database'
+ croak 'Install not possible as versions table already exists in database'
if $self->version_storage_is_installed;
- my $new_version = $self->to_version;
+ my $ddl = $self->_deploy;
- if ($new_version) {
- $self->_deploy;
-
- $self->add_database_version({
- version => $new_version,
- # ddl => $ddl,
- # upgrade_sql => $upgrade_sql,
- });
- }
+ $self->version_storage->add_database_version({
+ version => $self->to_version,
+ ddl => $ddl,
+ });
}
sub upgrade {