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