1 package DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated;
4 # ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
6 use File::Spec::Functions;
8 extends 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator';
10 sub _ddl_schema_consume_filenames {
11 my ($self, $type, $version) = @_;
12 return [$self->_ddl_schema_produce_filename($type, $version)]
15 sub _ddl_schema_produce_filename {
16 my ($self, $type, $version) = @_;
17 my $filename = ref $self->schema;
18 $filename =~ s/::/-/g;
21 $self->script_directory, "$filename-$version-$type.sql"
27 sub _ddl_schema_up_produce_filename {
28 my ($self, $type, $versions, $dir) = @_;
29 my $filename = ref $self->schema;
30 $filename =~ s/::/-/g;
33 $self->script_directory, "$filename-" . join( q(-), @{$versions} ) . "-$type.sql"
39 sub _ddl_schema_up_consume_filenames {
40 my ($self, $type, $versions) = @_;
41 return [$self->_ddl_schema_up_produce_filename($type, $versions)]
44 __PACKAGE__->meta->make_immutable;
48 # vim: ts=2 sw=2 expandtab
54 All this module does is override a few parts of
55 L<DBIx::Class::DeployMethd::SQL::Translator> so that the files generated with
56 L<DBIx::Class::Schema::Versioned> will work with this out of the box.
60 I begrudgingly made this module (and other related modules) to keep porting
61 from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes
62 to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc,
63 but I will not add any new features to it.
65 Once I hit major version 1 usage of this module will emit a warning.
66 On version 2 it will be removed entirely.
70 Yeah, this old Deprecated thing is a drag. It can't do downgrades, it can only
71 use a single .sql file for migrations, it has no .pl support. You should
72 totally switch! Here's how:
74 my $init_part = ref $schema;
75 $init_part =~ s/::/-/g;
76 opendir my $dh, 'sql';
78 if (/\Q$init_part\E-(.*)-(.*)(?:-(.*))?/) {
80 cp $_, $dh->deploy_method->_ddl_schema_up_produce_filename($3, [$1, $2]);
82 cp $_, $dh->deploy_method->_ddl_schema_produce_filename($2, $1);
87 =head1 OVERRIDDEN METHODS
93 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_consume_filenames>
97 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_produce_filename>
101 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_produce_filename>
105 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_consume_filenames>
111 This class is an implementation of
112 L<DBIx::Class::DeploymentHandler::HandlesDeploy>. Pretty much all the
113 documentation is there.