1 package DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated;
4 # ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
6 use Method::Signatures::Simple;
8 use File::Spec::Functions;
10 extends 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator',
12 method _ddl_schema_consume_filenames($type, $version) {
13 return [$self->_ddl_schema_produce_filename($type, $version)]
16 method _ddl_schema_produce_filename($type, $version) {
17 my $filename = ref $self->schema;
18 $filename =~ s/::/-/g;
21 $self->upgrade_directory, "$filename-$version-$type.sql"
27 method _ddl_schema_up_produce_filename($type, $versions, $dir) {
28 my $filename = ref $self->schema;
29 $filename =~ s/::/-/g;
32 $self->upgrade_directory, "$filename-" . join( q(-), @{$versions} ) . "-$type.sql"
38 method _ddl_schema_up_consume_filenames($type, $versions) {
39 return [$self->_ddl_schema_up_produce_filename($type, $versions)]
42 __PACKAGE__->meta->make_immutable;
46 # vim: ts=2 sw=2 expandtab
52 All this module does is override a few parts of
53 L<DBIx::Class::DeployMethd::SQL::Translator> so that the files generated with
54 L<DBIx::Class::Schema::Versioned> will work with this out of the box.
58 I begrudgingly made this module (and other related modules) to keep porting
59 from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes
60 to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc,
61 but I will not add any new features to it.
63 Once I hit major version 1 usage of this module will emit a warning.
64 On version 2 it will be removed entirely.
68 Yeah, this old Deprecated thing is a drag. It can't do downgrades, it can only
69 use a single .sql file for migrations, it has no .pl support. You should
70 totally switch! Here's how:
72 my $init_part = ref $schema;
73 $init_part =~ s/::/-/g;
74 opendir my $dh, 'sql';
76 if (/\Q$init_part\E-(.*)-(.*)(?:-(.*))?/) {
78 cp $_, $dh->deploy_method->_ddl_schema_up_produce_filename($3, [$1, $2]);
80 cp $_, $dh->deploy_method->_ddl_schema_produce_filename($2, $1);
85 =head1 OVERRIDDEN METHODS
91 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_consume_filenames>
95 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_produce_filename>
99 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_produce_filename>
103 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_consume_filenames>