line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated; |
2
|
|
|
|
|
|
|
$DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VERSION = '0.002233'; |
3
|
1
|
|
|
1
|
|
659
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
4
|
1
|
|
|
1
|
|
5895
|
use DBIx::Class::DeploymentHandler::LogImporter ':log'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: (DEPRECATED) Use this if you are stuck in the past |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has schema => ( |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
required => 1, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has version_rs => ( |
15
|
|
|
|
|
|
|
isa => 'DBIx::Class::ResultSet', |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
builder => '_build_version_rs', |
18
|
|
|
|
|
|
|
handles => [qw( database_version version_storage_is_installed )], |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage'; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
454
|
use DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
220
|
|
24
|
|
|
|
|
|
|
sub _build_version_rs { |
25
|
3
|
|
|
3
|
|
111
|
$_[0]->schema->register_class( |
26
|
|
|
|
|
|
|
dbix_class_schema_versions => |
27
|
|
|
|
|
|
|
'DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult' |
28
|
|
|
|
|
|
|
); |
29
|
3
|
|
|
|
|
1344
|
$_[0]->schema->resultset('dbix_class_schema_versions') |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub add_database_version { |
33
|
|
|
|
|
|
|
# deprecated doesn't support ddl or upgrade_ddl |
34
|
3
|
|
|
3
|
0
|
51
|
my $version = $_[1]->{version}; |
35
|
3
|
|
|
0
|
|
27
|
log_debug { "Adding database version $version" }; |
|
0
|
|
|
|
|
0
|
|
36
|
3
|
|
|
|
|
206
|
$_[0]->version_rs->create({ version => $version }) |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub delete_database_version { |
40
|
0
|
|
|
0
|
0
|
|
my $version = $_[1]->{version}; |
41
|
0
|
|
|
0
|
|
|
log_debug { "Deleting database version $version" }; |
|
0
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$_[0]->version_rs->search({ version => $version})->delete |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# vim: ts=2 sw=2 expandtab |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
DBIx::Class::DeploymentHandler::VersionStorage::Deprecated - (DEPRECATED) Use this if you are stuck in the past |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DEPRECATED |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
I begrudgingly made this module (and other related modules) to keep porting |
62
|
|
|
|
|
|
|
from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes |
63
|
|
|
|
|
|
|
to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc, |
64
|
|
|
|
|
|
|
but I will not add any new features to it. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Once I hit major version 1 usage of this module will emit a warning. |
67
|
|
|
|
|
|
|
On version 2 it will be removed entirely. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 THIS SUCKS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Here's how to convert from that crufty old Deprecated VersionStorage to a shiny |
72
|
|
|
|
|
|
|
new Standard VersionStorage: |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $s = My::Schema->connect(...); |
75
|
|
|
|
|
|
|
my $dh = DeploymentHandler({ |
76
|
|
|
|
|
|
|
schema => $s, |
77
|
|
|
|
|
|
|
}); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
$dh->prepare_version_storage_install; |
80
|
|
|
|
|
|
|
$dh->install_version_storage; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my @versions = $s->{vschema}->resultset('Table')->search(undef, { |
83
|
|
|
|
|
|
|
order_by => 'installed', |
84
|
|
|
|
|
|
|
})->get_column('version')->all; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$dh->version_storage->add_database_vesion({ version => $_ }) |
87
|
|
|
|
|
|
|
for @versions; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SEE ALSO |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This class is an implementation of |
92
|
|
|
|
|
|
|
L<DBIx::Class::DeploymentHandler::HandlesVersionStorage>. Pretty much all the |
93
|
|
|
|
|
|
|
documentation is there. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
104
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |