X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-DeploymentHandler.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FDeployMethod%2FSQL%2FTranslator.pm;h=101ae2ea717a4a14375787a4664f89e7c57309ca;hp=5dbc9f2f9a4a581f3232ddbc7c23888e2c38c6a3;hb=73caa630f1795abc83d57c6b08becc8395215e94;hpb=ed45e175a490befb264f8d20f3e5702b6b0b22aa 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' )