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;
9 require SQL::Translator::Diff;
11 extends 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator',
13 method _ddl_schema_consume_filenames($type, $version) {
14 return [$self->_ddl_schema_produce_filename($type, $version)]
17 method _ddl_schema_produce_filename($type, $version) {
18 my $filename = ref $self->schema;
19 $filename =~ s/::/-/g;
22 $self->script_directory, "$filename-$version-$type.sql"
28 method _ddl_schema_up_produce_filename($type, $versions, $dir) {
29 my $filename = ref $self->schema;
30 $filename =~ s/::/-/g;
33 $self->script_directory, "$filename-" . join( q(-), @{$versions} ) . "-$type.sql"
39 method _ddl_schema_up_consume_filenames($type, $versions) {
40 return [$self->_ddl_schema_up_produce_filename($type, $versions)]
43 method _generate_final_diff($source_schema, $dest_schema, $db, $sqltargs) {
44 scalar SQL::Translator::Diff::schema_diff(
51 method _default_read_sql_file_as_string($file) {
52 do { local( @ARGV, $/ ) = $file; <> } # slurp
55 method _generate_final_sql($sqlt) { scalar $sqlt->translate }
57 __PACKAGE__->meta->make_immutable;
61 # vim: ts=2 sw=2 expandtab
67 All this module does is override a few parts of
68 L<DBIx::Class::DeployMethd::SQL::Translator> so that the files generated with
69 L<DBIx::Class::Schema::Versioned> will work with this out of the box.
73 I begrudgingly made this module (and other related modules) to keep porting
74 from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes
75 to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc,
76 but I will not add any new features to it.
78 Once I hit major version 1 usage of this module will emit a warning.
79 On version 2 it will be removed entirely.
83 Yeah, this old Deprecated thing is a drag. It can't do downgrades, it can only
84 use a single .sql file for migrations, it has no .pl support. You should
85 totally switch! Here's how:
87 my $init_part = ref $schema;
88 $init_part =~ s/::/-/g;
89 opendir my $dh, 'sql';
91 if (/\Q$init_part\E-(.*)-(.*)(?:-(.*))?/) {
93 cp $_, $dh->deploy_method->_ddl_schema_up_produce_filename($3, [$1, $2]);
95 cp $_, $dh->deploy_method->_ddl_schema_produce_filename($2, $1);
100 =head1 OVERRIDDEN METHODS
106 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_consume_filenames>
110 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_produce_filename>
114 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_produce_filename>
118 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_consume_filenames>