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