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