Commit | Line | Data |
0905dc0e |
1 | package DBIx::Class::DeploymentHandler::VersionStorage::Standard; |
2 | use Moose; |
3 | use Method::Signatures::Simple; |
4 | |
5 | has schema => ( |
6 | isa => 'DBIx::Class::Schema', |
7 | is => 'ro', |
8 | required => 1, |
9 | ); |
10 | |
11 | has version_rs => ( |
12 | isa => 'DBIx::Class::ResultSet', |
13 | is => 'ro', |
9af9d0b2 |
14 | lazy_build => 1, |
0905dc0e |
15 | handles => [qw( database_version version_storage_is_installed )], |
16 | ); |
17 | |
18 | with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage'; |
19 | |
20 | sub _build_version_rs { |
6bbb6ce7 |
21 | $_[0]->schema->register_class( |
22 | __VERSION => |
23 | 'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult' |
24 | ); |
25 | $_[0]->schema->resultset('__VERSION') |
0905dc0e |
26 | } |
27 | |
28 | sub add_database_version { $_[0]->version_rs->create($_[1]) } |
29 | |
f344dd91 |
30 | sub delete_database_version { |
31 | $_[0]->version_rs->search({ version => $_[1]->{version}})->delete |
32 | } |
33 | |
c9149a81 |
34 | __PACKAGE__->meta->make_immutable; |
35 | |
0905dc0e |
36 | 1; |
37 | |
38 | __END__ |
39 | |
b0bf9d6b |
40 | =head1 THIS SUCKS |
41 | |
42 | You started your project and weren't using DBICDH? FOOL! Lucky for you I had |
43 | you in mind when I wrote this doc <3 |
44 | |
45 | First off, you'll want to just install the version_storage: |
46 | |
47 | my $s = My::Schema->connect(...); |
48 | my $dh = DeployHandler({ schema => $s }); |
49 | |
50 | $dh->prepare_version_storage_install; |
51 | $dh->install_version_storage; |
52 | |
53 | Then, bump your schema version, and you can use DBICDH like normal! |
54 | |
0905dc0e |
55 | vim: ts=2 sw=2 expandtab |