Add a few missing ABSTRACTs
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / VersionStorage / Deprecated.pm
CommitLineData
fe3b6dff 1package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated;
01342998 2use Moose;
56203087 3use DBIx::Class::DeploymentHandler::LogImporter ':log';
0df68524 4
9deabd1f 5
6# ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
7
01342998 8has schema => (
01342998 9 is => 'ro',
10 required => 1,
11);
12
13has version_rs => (
14 isa => 'DBIx::Class::ResultSet',
15 is => 'ro',
fe3b6dff 16 builder => '_build_version_rs',
01342998 17 handles => [qw( database_version version_storage_is_installed )],
18);
19
20with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage';
21
fe3b6dff 22use DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult;
01342998 23sub _build_version_rs {
24 $_[0]->schema->register_class(
25 dbix_class_schema_versions =>
26 'DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult'
27 );
28 $_[0]->schema->resultset('dbix_class_schema_versions')
29}
30
31sub add_database_version {
32 # deprecated doesn't support ddl or upgrade_ddl
0df68524 33 my $version = $_[1]->{version};
f4075791 34 log_debug { "Adding database version $version" };
0df68524 35 $_[0]->version_rs->create({ version => $version })
01342998 36}
37
f344dd91 38sub delete_database_version {
0df68524 39 my $version = $_[1]->{version};
f4075791 40 log_debug { "Deleting database version $version" };
0df68524 41 $_[0]->version_rs->search({ version => $version})->delete
f344dd91 42}
43
01342998 44__PACKAGE__->meta->make_immutable;
45
461;
47
e52174e3 48# vim: ts=2 sw=2 expandtab
49
01342998 50__END__
51
bcc72297 52=head1 DEPRECATED
53
54I begrudgingly made this module (and other related modules) to keep porting
55from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes
56to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc,
57but I will not add any new features to it.
58
59Once I hit major version 1 usage of this module will emit a warning.
60On version 2 it will be removed entirely.
61
3885a58b 62=head1 THIS SUCKS
63
64Here's how to convert from that crufty old Deprecated VersionStorage to a shiny
65new Standard VersionStorage:
66
67 my $s = My::Schema->connect(...);
68 my $dh = DeploymentHandler({
69 schema => $s,
70 });
71
72 $dh->prepare_version_storage_install;
73 $dh->install_version_storage;
74
75 my @versions = $s->{vschema}->resultset('Table')->search(undef, {
76 order_by => 'installed',
77 })->get_column('version')->all;
78
79 $dh->version_storage->add_database_vesion({ version => $_ })
80 for @versions;
81
ec167a97 82=head1 SEE ALSO
83
84This class is an implementation of
85L<DBIx::Class::DeploymentHandler::HandlesVersionStorage>. Pretty much all the
86documentation is there.