Commit | Line | Data |
3c1b5ee8 |
1 | package DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated; |
97aa9a74 |
2 | |
3c1b5ee8 |
3 | use Moose; |
9deabd1f |
4 | |
5 | # ABSTRACT: (DEPRECATED) Use this if you are stuck in the past |
6 | |
42c2fec3 |
7 | use File::Spec::Functions; |
8 | |
ffe7229c |
9 | extends 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator'; |
3c1b5ee8 |
10 | |
ffe7229c |
11 | sub _ddl_schema_consume_filenames { |
12 | my ($self, $type, $version) = @_; |
3885a58b |
13 | return [$self->_ddl_schema_produce_filename($type, $version)] |
42c2fec3 |
14 | } |
15 | |
ffe7229c |
16 | sub _ddl_schema_produce_filename { |
17 | my ($self, $type, $version) = @_; |
3c1b5ee8 |
18 | my $filename = ref $self->schema; |
19 | $filename =~ s/::/-/g; |
20 | |
42c2fec3 |
21 | $filename = catfile( |
91adde75 |
22 | $self->script_directory, "$filename-$version-$type.sql" |
3c1b5ee8 |
23 | ); |
24 | |
42c2fec3 |
25 | return $filename; |
3c1b5ee8 |
26 | } |
27 | |
ffe7229c |
28 | sub _ddl_schema_up_produce_filename { |
29 | my ($self, $type, $versions, $dir) = @_; |
3c1b5ee8 |
30 | my $filename = ref $self->schema; |
31 | $filename =~ s/::/-/g; |
32 | |
42c2fec3 |
33 | $filename = catfile( |
91adde75 |
34 | $self->script_directory, "$filename-" . join( q(-), @{$versions} ) . "-$type.sql" |
3c1b5ee8 |
35 | ); |
36 | |
42c2fec3 |
37 | return $filename; |
3c1b5ee8 |
38 | } |
39 | |
ffe7229c |
40 | sub _ddl_schema_up_consume_filenames { |
41 | my ($self, $type, $versions) = @_; |
3885a58b |
42 | return [$self->_ddl_schema_up_produce_filename($type, $versions)] |
42c2fec3 |
43 | } |
44 | |
45 | __PACKAGE__->meta->make_immutable; |
46 | |
3c1b5ee8 |
47 | 1; |
3885a58b |
48 | |
e52174e3 |
49 | # vim: ts=2 sw=2 expandtab |
50 | |
3885a58b |
51 | __END__ |
52 | |
bcc72297 |
53 | =head1 DESCRIPTION |
54 | |
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. |
58 | |
59 | =head1 DEPRECATED |
60 | |
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. |
65 | |
66 | Once I hit major version 1 usage of this module will emit a warning. |
67 | On version 2 it will be removed entirely. |
68 | |
3885a58b |
69 | =head1 THIS SUCKS |
70 | |
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: |
74 | |
75 | my $init_part = ref $schema; |
76 | $init_part =~ s/::/-/g; |
77 | opendir my $dh, 'sql'; |
78 | for (readdir $dh) { |
79 | if (/\Q$init_part\E-(.*)-(.*)(?:-(.*))?/) { |
80 | if (defined $3) { |
81 | cp $_, $dh->deploy_method->_ddl_schema_up_produce_filename($3, [$1, $2]); |
82 | } else { |
83 | cp $_, $dh->deploy_method->_ddl_schema_produce_filename($2, $1); |
84 | } |
85 | } |
86 | } |
87 | |
bcc72297 |
88 | =head1 OVERRIDDEN METHODS |
89 | |
90 | =over |
91 | |
92 | =item * |
93 | |
94 | L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_consume_filenames> |
95 | |
96 | =item * |
97 | |
98 | L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_produce_filename> |
99 | |
100 | =item * |
101 | |
102 | L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_produce_filename> |
103 | |
104 | =item * |
105 | |
106 | L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_consume_filenames> |
107 | |
108 | =back |
109 | |
ec167a97 |
110 | =head1 SEE ALSO |
111 | |
112 | This class is an implementation of |
113 | L<DBIx::Class::DeploymentHandler::HandlesDeploy>. Pretty much all the |
114 | documentation is there. |