DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm

filter: Statementstmt 68.0% 17 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod n/a totaltotal 67.7% 21 / 31 CC 1 SCAR 2.9
CC
1
Cov
68%
_ddl_schema_up_produce_filename
2.0
_ddl_schema_up_consume_filenames
2.0
BEGIN
1.0
CRAP 1.3
« DeploymentHandler/LogImporter.pm ↑ Summary DeploymentHandler/WithApplicatorDumple.pm »
1 package DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated;
2 2 $DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated::VERSION = '0.002233';
3 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
6  
7 2 ▶use File::Spec::Functions;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 extends 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator';
10  
11 sub _ddl_schema_consume_filenames {
12 2 ▶ my ($self, $type, $version) = @_;
Subroutine _ddl_schema_consume_filenames: called CC=1 SCAR=0.0
13 2 return [$self->_ddl_schema_produce_filename($type, $version)]
14 }
15  
16 sub _ddl_schema_produce_filename {
17 7 ▶ my ($self, $type, $version) = @_;
Subroutine _ddl_schema_produce_filename: called CC=1 SCAR=0.0
18 7 my $filename = ref $self->schema;
19 7 $filename =~ s/::/-/g;
20  
21 7 $filename = catfile(
22 $self->script_directory, "$filename-$version-$type.sql"
23 );
24  
25 7 return $filename;
26 }
27  
28 sub _ddl_schema_up_produce_filename {
29 0 ▶ my ($self, $type, $versions, $dir) = @_;
Subroutine _ddl_schema_up_produce_filename: not called CC=1 SCAR=6.9
30 0 my $filename = ref $self->schema;
31 0 $filename =~ s/::/-/g;
32  
33 $filename = catfile(
34 0 $self->script_directory, "$filename-" . join( q(-), @{$versions} ) . "-$type.sql"
35 );
36  
37 0 return $filename;
38 }
39  
40 sub _ddl_schema_up_consume_filenames {
41 0 ▶ my ($self, $type, $versions) = @_;
Subroutine _ddl_schema_up_consume_filenames: not called CC=1 SCAR=6.9
42 0 return [$self->_ddl_schema_up_produce_filename($type, $versions)]
43 }
44  
45 2 __PACKAGE__->meta->make_immutable;
46  
47 2 1;
48  
49 # vim: ts=2 sw=2 expandtab
50  
51 __END__
52  
53 =pod
54  
55 =head1 NAME
56  
57 DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated - (DEPRECATED) Use this if you are stuck in the past
58  
59 =head1 DESCRIPTION
60  
61 All this module does is override a few parts of
62 L<DBIx::Class::DeployMethd::SQL::Translator> so that the files generated with
63 L<DBIx::Class::Schema::Versioned> will work with this out of the box.
64  
65 =head1 DEPRECATED
66  
67 I begrudgingly made this module (and other related modules) to keep porting
68 from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes
69 to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc,
70 but I will not add any new features to it.
71  
72 Once I hit major version 1 usage of this module will emit a warning.
73 On version 2 it will be removed entirely.
74  
75 =head1 THIS SUCKS
76  
77 Yeah, this old Deprecated thing is a drag. It can't do downgrades, it can only
78 use a single .sql file for migrations, it has no .pl support. You should
79 totally switch! Here's how:
80  
81 my $init_part = ref $schema;
82 $init_part =~ s/::/-/g;
83 opendir my $dh, 'sql';
84 for (readdir $dh) {
85 if (/\Q$init_part\E-(.*)-(.*)(?:-(.*))?/) {
86 if (defined $3) {
87 cp $_, $dh->deploy_method->_ddl_schema_up_produce_filename($3, [$1, $2]);
88 } else {
89 cp $_, $dh->deploy_method->_ddl_schema_produce_filename($2, $1);
90 }
91 }
92 }
93  
94 =head1 OVERRIDDEN METHODS
95  
96 =over
97  
98 =item *
99  
100 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_consume_filenames>
101  
102 =item *
103  
104 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_produce_filename>
105  
106 =item *
107  
108 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_produce_filename>
109  
110 =item *
111  
112 L<DBIx::Class::DeployMethod::SQL::Translator/_ddl_schema_up_consume_filenames>
113  
114 =back
115  
116 =head1 SEE ALSO
117  
118 This class is an implementation of
119 L<DBIx::Class::DeploymentHandler::HandlesDeploy>. Pretty much all the
120 documentation is there.
121  
122 =head1 AUTHOR
123  
124 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
125  
126 =head1 COPYRIGHT AND LICENSE
127  
128 This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
129  
130 This is free software; you can redistribute it and/or modify it under
131 the same terms as the Perl 5 programming language system itself.
132  
133 =cut
« DeploymentHandler/LogImporter.pm ↑ Summary DeploymentHandler/WithApplicatorDumple.pm »