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=813013ce4d5113a0683fe8bff5e2e0b1aa440408;hb=91adde755e5808a1ec12bcf00e683e3754964cc9;hp=19a7370e5e7407002df801e12c3dfea33a00fec2;hpb=42c2fec3aa2d4bb0eeff20637a883538f2737c80;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 19a7370..813013c 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm @@ -1,5 +1,8 @@ package DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated; use Moose; + +# ABSTRACT: (DEPRECATED) Use this if you are stuck in the past + use Method::Signatures::Simple; use File::Spec::Functions; @@ -7,7 +10,7 @@ use File::Spec::Functions; extends 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator', method _ddl_schema_consume_filenames($type, $version) { - return [$self->_ddl_schema_produce_filename($type, $version)] + return [$self->_ddl_schema_produce_filename($type, $version)] } method _ddl_schema_produce_filename($type, $version) { @@ -15,7 +18,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; @@ -26,16 +29,78 @@ 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; } method _ddl_schema_up_consume_filenames($type, $versions) { - return [$self->_ddl_schema_up_produce_filename($type, $versions)] + return [$self->_ddl_schema_up_produce_filename($type, $versions)] } __PACKAGE__->meta->make_immutable; 1; + +# vim: ts=2 sw=2 expandtab + +__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 +use a single .sql file for migrations, it has no .pl support. You should +totally switch! Here's how: + + my $init_part = ref $schema; + $init_part =~ s/::/-/g; + opendir my $dh, 'sql'; + for (readdir $dh) { + if (/\Q$init_part\E-(.*)-(.*)(?:-(.*))?/) { + if (defined $3) { + cp $_, $dh->deploy_method->_ddl_schema_up_produce_filename($3, [$1, $2]); + } else { + cp $_, $dh->deploy_method->_ddl_schema_produce_filename($2, $1); + } + } + } + +=head1 OVERRIDDEN METHODS + +=over + +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + +=back +