use Moose;
use Method::Signatures::Simple;
-use DBIx::Class::DeploymentHandler::Types;
require DBIx::Class::Schema; # loaded for type constraint
-require DBIx::Class::ResultSet; # loaded for type constraint
use Carp::Clan '^DBIx::Class::DeploymentHandler';
has schema => (
handles => ['schema_version'],
);
-has upgrade_directory => ( # configuration
- isa => 'Str',
- is => 'ro',
- required => 1,
- default => 'sql',
-);
-
-has backup_directory => ( # configuration
+has backup_directory => (
isa => 'Str',
is => 'ro',
predicate => 'has_backup_directory',
);
-has to_version => ( # configuration
+has to_version => (
is => 'ro',
lazy_build => 1,
);
sub _build_to_version { $_[0]->schema->schema_version }
-has databases => ( # configuration
- coerce => 1,
- isa => 'DBIx::Class::DeploymentHandler::Databases',
- is => 'ro',
- default => sub { [qw( MySQL SQLite PostgreSQL )] },
-);
-
-has sqltargs => ( # configuration
- isa => 'HashRef',
- is => 'ro',
- default => sub { {} },
-);
-
method install {
croak 'Install not possible as versions table already exists in database'
if $self->version_storage_is_installed;
The L<DBIx::Class::Schema> (B<required>) that is used to talk to the database
and generate the DDL.
-# this should be in a different place, maybe the SQLT role
-# this should be renamed
-=attr upgrade_directory
-
-The directory (default C<'sql'>) that upgrades are stored in
-
=attr backup_directory
The directory that backups are stored in
The version (defaults to schema's version) to migrate the database to
-# this should be in a different place, maybe the SQLT role
-=attr databases
-
-The types of databases (default C<< [qw( MySQL SQLite PostgreSQL )] >>) to
-generate files for
-
-
=method install
$dh->install
handles => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
);
+has upgrade_directory => (
+ isa => 'Str',
+ is => 'ro',
+ required => 1,
+ default => 'sql',
+);
+
+has databases => (
+ coerce => 1,
+ isa => 'DBIx::Class::DeploymentHandler::Databases',
+ is => 'ro',
+ default => sub { [qw( MySQL SQLite PostgreSQL )] },
+);
+
+has sqltargs => (
+ isa => 'HashRef',
+ is => 'ro',
+ default => sub { {} },
+);
+
sub _build_deploy_method {
my $self = shift;
DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated->new({
handles => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
);
+has upgrade_directory => (
+ isa => 'Str',
+ is => 'ro',
+ required => 1,
+ default => 'sql',
+);
+
+has databases => (
+ coerce => 1,
+ isa => 'DBIx::Class::DeploymentHandler::Databases',
+ is => 'ro',
+ default => sub { [qw( MySQL SQLite PostgreSQL )] },
+);
+
+has sqltargs => (
+ isa => 'HashRef',
+ is => 'ro',
+ default => sub { {} },
+);
+
sub _build_deploy_method {
my $self = shift;
DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator->new({