1 package DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated;
3 use Method::Signatures::Simple;
5 use File::Spec::Functions;
7 extends 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator',
9 method _ddl_schema_consume_filenames($type, $version) {
10 return [$self->_ddl_schema_produce_filename($type, $version)]
13 method _ddl_schema_produce_filename($type, $version) {
14 my $filename = ref $self->schema;
15 $filename =~ s/::/-/g;
18 $self->upgrade_directory, "$filename-$version-$type.sql"
24 method _ddl_schema_up_produce_filename($type, $versions, $dir) {
25 my $filename = ref $self->schema;
26 $filename =~ s/::/-/g;
29 $self->upgrade_directory, "$filename-" . join( q(-), @{$versions} ) . "-$type.sql"
35 method _ddl_schema_up_consume_filenames($type, $versions) {
36 return [$self->_ddl_schema_up_produce_filename($type, $versions)]
39 __PACKAGE__->meta->make_immutable;
43 # vim: ts=2 sw=2 expandtab
49 Yeah, this old Deprecated thing is a drag. It can't do downgrades, it can only
50 use a single .sql file for migrations, it has no .pl support. You should
51 totally switch! Here's how:
53 my $init_part = ref $schema;
54 $init_part =~ s/::/-/g;
55 opendir my $dh, 'sql';
57 if (/\Q$init_part\E-(.*)-(.*)(?:-(.*))?/) {
59 cp $_, $dh->deploy_method->_ddl_schema_up_produce_filename($3, [$1, $2]);
61 cp $_, $dh->deploy_method->_ddl_schema_produce_filename($2, $1);