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