X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FDeployMethod%2FSQL%2FTranslator%2FDeprecated.pm;h=6e7a6049142c176073adf3105d1e77d48bfde28b;hb=1f0d0633940a59386e5c0ebec602d0650a3694ed;hp=96fb07364274902fd282e151f3fac15e569721d8;hpb=9deabd1fcf64a04422d1903f8656ac445e73336a;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm index 96fb073..6e7a604 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm @@ -6,6 +6,7 @@ use Moose; use Method::Signatures::Simple; use File::Spec::Functions; +require SQL::Translator::Diff; extends 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator', @@ -18,7 +19,7 @@ method _ddl_schema_produce_filename($type, $version) { $filename =~ s/::/-/g; $filename = catfile( - $self->upgrade_directory, "$filename-$version-$type.sql" + $self->script_directory, "$filename-$version-$type.sql" ); return $filename; @@ -29,7 +30,7 @@ method _ddl_schema_up_produce_filename($type, $versions, $dir) { $filename =~ s/::/-/g; $filename = catfile( - $self->upgrade_directory, "$filename-" . join( q(-), @{$versions} ) . "-$type.sql" + $self->script_directory, "$filename-" . join( q(-), @{$versions} ) . "-$type.sql" ); return $filename; @@ -39,6 +40,20 @@ method _ddl_schema_up_consume_filenames($type, $versions) { return [$self->_ddl_schema_up_produce_filename($type, $versions)] } +method _generate_final_diff($source_schema, $dest_schema, $db, $sqltargs) { + scalar SQL::Translator::Diff::schema_diff( + $source_schema, $db, + $dest_schema, $db, + $sqltargs + ) +} + +method _default_read_sql_file_as_string($file) { + do { local( @ARGV, $/ ) = $file; <> } # slurp +} + +method _generate_final_sql($sqlt) { scalar $sqlt->translate } + __PACKAGE__->meta->make_immutable; 1; @@ -47,6 +62,22 @@ __PACKAGE__->meta->make_immutable; __END__ +=head1 DESCRIPTION + +All this module does is override a few parts of +L so that the files generated with +L will work with this out of the box. + +=head1 DEPRECATED + +I begrudgingly made this module (and other related modules) to keep porting +from L relatively simple. I will make changes +to ensure that it works with output from L etc, +but I will not add any new features to it. + +Once I hit major version 1 usage of this module will emit a warning. +On version 2 it will be removed entirely. + =head1 THIS SUCKS Yeah, this old Deprecated thing is a drag. It can't do downgrades, it can only @@ -66,3 +97,25 @@ totally switch! Here's how: } } +=head1 OVERRIDDEN METHODS + +=over + +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + +=back +