File Coverage

blib/lib/DBIx/Class/DeploymentHandler/Deprecated.pm
Criterion Covered Total %
statement 10 12 83.3
branch 1 2 50.0
condition 1 3 33.3
subroutine 3 4 75.0
pod 0 2 0.0
total 15 23 65.2


line stmt bran cond sub pod time code
1             package DBIx::Class::DeploymentHandler::Deprecated;
2             $DBIx::Class::DeploymentHandler::Deprecated::VERSION = '0.002233';
3             # ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
4              
5 1     1   20801 use Moose;
  1         381935  
  1         7  
6 1     1   6173 use Moose::Util 'apply_all_roles';
  1         3  
  1         6  
7              
8 0     0 0 0 sub initial_version { return $_[0]->database_version }
9              
10             extends 'DBIx::Class::DeploymentHandler::Dad';
11             # a single with would be better, but we can't do that
12             # see: http://rt.cpan.org/Public/Bug/Display.html?id=46347
13             with 'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
14             interface_role => 'DBIx::Class::DeploymentHandler::HandlesDeploy',
15             class_name => 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated',
16             delegate_name => 'deploy_method',
17             attributes_to_assume => ['schema'],
18             attributes_to_copy => [qw( script_directory databases sql_translator_args )],
19             },
20             'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
21             interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersionStorage',
22             class_name => 'DBIx::Class::DeploymentHandler::VersionStorage::Deprecated',
23             delegate_name => 'version_storage',
24             attributes_to_assume => ['schema'],
25             };
26             with 'DBIx::Class::DeploymentHandler::WithReasonableDefaults';
27              
28             sub BUILD {
29 3     3 0 8 my $self = shift;
30              
31 3 50 33     99 if ($self->schema->can('ordered_versions') && $self->schema->ordered_versions) {
32 0         0 apply_all_roles(
33             $self,
34             'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
35             interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
36             class_name => 'DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions',
37             delegate_name => 'version_handler',
38             attributes_to_assume => [qw( database_version schema_version to_version )],
39             }
40             );
41             } else {
42 3         31 apply_all_roles(
43             $self,
44             'DBIx::Class::DeploymentHandler::WithApplicatorDumple' => {
45             interface_role => 'DBIx::Class::DeploymentHandler::HandlesVersioning',
46             class_name => 'DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions',
47             delegate_name => 'version_handler',
48             attributes_to_assume => [qw( database_version schema_version to_version )],
49             }
50             );
51             }
52             # the following is just a hack so that ->version_storage
53             # won't be lazy
54 3         17436 $self->version_storage;
55             }
56              
57             __PACKAGE__->meta->make_immutable;
58              
59             1;
60              
61             # vim: ts=2 sw=2 expandtab
62              
63             __END__
64              
65             =pod
66              
67             =head1 NAME
68              
69             DBIx::Class::DeploymentHandler::Deprecated - (DEPRECATED) Use this if you are stuck in the past
70              
71             =head1 SYNOPSIS
72              
73             Look at L<DBIx::Class::DeploymentHandler/SYNPOSIS>. I won't repeat
74             it here to emphasize, yet again, that this should not be used unless you really
75             want to live in the past.
76              
77             =head1 DEPRECATED
78              
79             I begrudgingly made this module (and other related modules) to make porting
80             from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes
81             to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc,
82             but I will not add any new features to it. It already lacks numerous features
83             that the full version provides in style:
84              
85             =over
86              
87             =item *
88              
89             Downgrades
90              
91             =item *
92              
93             Multiple files for migrations
94              
95             =item *
96              
97             Perl files in migrations
98              
99             =item *
100              
101             Shared Perl/SQL for different databases
102              
103             =back
104              
105             And there's probably more.
106              
107             At version 1.000000 usage of this module will emit a warning. At version
108             2.000000 it will be removed entirely.
109              
110             To migrate to the New Hotness take a look at:
111             L<DBIx::Class::DeploymentHandler::VersionStorage::Deprecated/THIS SUCKS> and
112             L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated/THIS SUCKS>.
113              
114             =head1 WHERE IS ALL THE DOC?!
115              
116             C<DBIx::Class::DeploymentHandler::Deprecated> extends
117             L<DBIx::Class::DeploymentHandler::Dad>, so that's probably the first place to
118             look when you are trying to figure out how everything works.
119              
120             Next would be to look at all the pieces that fill in the blanks that
121             L<DBIx::Class::DeploymentHandler::Dad> expects to be filled. They would be
122             L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated>,
123             L<DBIx::Class::DeploymentHandler::VersionStorage::Deprecated>, and
124             L<DBIx::Class::DeploymentHandler::WithReasonableDefaults>. Also, this class
125             is special in that it applies either
126             L<DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions> or
127             L<DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions> depending on
128             your schema.
129              
130             =head1 AUTHOR
131              
132             Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
133              
134             =head1 COPYRIGHT AND LICENSE
135              
136             This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
137              
138             This is free software; you can redistribute it and/or modify it under
139             the same terms as the Perl 5 programming language system itself.
140              
141             =cut