From: Arthur Axel 'fREW' Schmidt Date: Fri, 2 Apr 2010 05:53:00 +0000 (-0500) Subject: take silly stuff out of ::Dad and put it where it belongs X-Git-Tag: v0.001000_01~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cfc9edf93ec15cb3ae64af76905d96c89681f51b;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git take silly stuff out of ::Dad and put it where it belongs --- diff --git a/lib/DBIx/Class/DeploymentHandler/Dad.pm b/lib/DBIx/Class/DeploymentHandler/Dad.pm index e80df8d..db485b3 100644 --- a/lib/DBIx/Class/DeploymentHandler/Dad.pm +++ b/lib/DBIx/Class/DeploymentHandler/Dad.pm @@ -2,9 +2,7 @@ package DBIx::Class::DeploymentHandler::Dad; 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 => ( @@ -14,39 +12,19 @@ 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; @@ -95,12 +73,6 @@ __PACKAGE__->meta->make_immutable; The L (B) 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 @@ -109,13 +81,6 @@ 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 diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 06ec56d..cc37175 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -429,8 +429,17 @@ __END__ =attr schema =attr storage =attr sqltargs + +#rename =attr upgrade_directory + +The directory (default C<'sql'>) that upgrades are stored in + =attr databases + +The types of databases (default C<< [qw( MySQL SQLite PostgreSQL )] >>) to +generate files for + =attr txn_wrap =method __ddl_consume_with_prefix diff --git a/lib/DBIx/Class/DeploymentHandler/Deprecated/WithDeprecatedSqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/Deprecated/WithDeprecatedSqltDeployMethod.pm index ab68755..99912cd 100644 --- a/lib/DBIx/Class/DeploymentHandler/Deprecated/WithDeprecatedSqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/Deprecated/WithDeprecatedSqltDeployMethod.pm @@ -10,6 +10,26 @@ has deploy_method => ( 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({ diff --git a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm index 20f92f7..b0bf914 100644 --- a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm @@ -10,6 +10,26 @@ has deploy_method => ( 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({