From: Arthur Axel 'fREW' Schmidt Date: Tue, 4 May 2010 18:37:17 +0000 (-0500) Subject: spread TODOs out X-Git-Tag: v0.001000_05^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=73caa630f1795abc83d57c6b08becc8395215e94;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git spread TODOs out add more schema_version attr --- diff --git a/Changes b/Changes index 3e0abd3..fd693b3 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for {{$dist->name}} {{$NEXT}} + - put schema_version attr in more places 0.001000_04 2010-04-27 13:29:14 CST6CDT - schema_version is now an attr so that users can more easily force the diff --git a/TODO b/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/dist.ini b/dist.ini index a8aefdf..5b4cc5d 100644 --- a/dist.ini +++ b/dist.ini @@ -2,7 +2,7 @@ name = DBIx-Class-DeploymentHandler author = Arthur Axel "fREW" Schmidt license = Perl_5 copyright_holder = Arthur Axel "fREW" Schmidt -version = 0.001000_04 +version = 0.001000_05 [@Git] [@Filter] diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 5dbc9f2..101ae2e 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -22,7 +22,6 @@ has schema => ( isa => 'DBIx::Class::Schema', is => 'ro', required => 1, - handles => [qw( schema_version )], ); has storage => ( @@ -62,6 +61,13 @@ has txn_wrap => ( default => 1, ); +has schema_version => ( + is => 'ro', + lazy_build => 1, +); + +method _build_schema_version { $self->schema->schema_version } + method __ddl_consume_with_prefix($type, $versions, $prefix) { my $base_dir = $self->upgrade_directory; @@ -193,13 +199,13 @@ sub deploy { } sub _prepare_install { - my $self = shift; + my $self = shift; my $sqltargs = { %{$self->sqltargs}, %{shift @_} }; my $to_file = shift; my $schema = $self->schema; my $databases = $self->databases; my $dir = $self->upgrade_directory; - my $version = $schema->schema_version; + my $version = $self->schema_version; my $sqlt = SQL::Translator->new({ add_drop_table => 1, @@ -292,7 +298,7 @@ method _prepare_changegrade($from_version, $to_version, $version_set, $direction my $dir = $self->upgrade_directory; my $sqltargs = $self->sqltargs; - my $schema_version = $schema->schema_version; + my $schema_version = $self->schema_version; $sqltargs = { add_drop_table => 1, @@ -541,7 +547,8 @@ and generate the DDL. This is automatically created with L. =attr sqltargs -#rename +TODO +# rename =attr upgrade_directory @@ -557,6 +564,11 @@ generate files for Set to true (which is the default) to wrap all upgrades and deploys in a single transaction. +=attr schema_version + +The version the schema on your harddrive is at. Defaults to +C<< $self->schema->schema_version >>. + =method __ddl_consume_with_prefix $dm->__ddl_consume_with_prefix( 'SQLite', [qw( 1.00 1.01 )], 'up' ) diff --git a/lib/DBIx/Class/DeploymentHandler/WithDatabaseToSchemaVersions.pm b/lib/DBIx/Class/DeploymentHandler/WithDatabaseToSchemaVersions.pm index f04effa..a1daf09 100644 --- a/lib/DBIx/Class/DeploymentHandler/WithDatabaseToSchemaVersions.pm +++ b/lib/DBIx/Class/DeploymentHandler/WithDatabaseToSchemaVersions.pm @@ -32,3 +32,4 @@ sub _build_version_handler { __END__ +TODO: pod diff --git a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm index 62e854b..8b3f5cc 100644 --- a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm @@ -34,12 +34,15 @@ has sqltargs => ( sub _build_deploy_method { my $self = shift; - DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator->new({ + my $args = { schema => $self->schema, databases => $self->databases, upgrade_directory => $self->upgrade_directory, sqltargs => $self->sqltargs, - }); + }; + + $args->{schema_version} = $self->schema_version if $self->has_schema_version; + DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator->new($args); } 1; @@ -47,3 +50,5 @@ sub _build_deploy_method { # vim: ts=2 sw=2 expandtab __END__ + +TODO: pod