Commit | Line | Data |
e70a1600 |
1 | package DBIx::Class::DeploymentHandler::WithDatabaseToSchemaVersions; |
2 | use Moose::Role; |
3 | |
4 | use DBIx::Class::DeploymentHandler::DatabaseToSchemaVersions; |
5 | |
6 | use Carp 'carp'; |
7 | |
8 | has version_handler => ( |
9 | |
10 | # < mst> isa => 'DBIx::Class::DeploymentHandler::SqltDeployMethod', |
11 | # < mst> should be |
12 | # < mst> does => <some role> |
13 | # < mst> and that role should supply those methods |
14 | # < mst> then you can pass handles => <some role> as well |
15 | |
38bd9956 |
16 | does => 'DBIx::Class::DeploymentHandler::HandlesVersioning', |
e70a1600 |
17 | is => 'ro', |
18 | lazy_build => 1, |
38bd9956 |
19 | handles => 'DBIx::Class::DeploymentHandler::HandlesVersioning', |
e70a1600 |
20 | ); |
21 | |
22 | sub _build_version_handler { |
23 | my $self = shift; |
38bd9956 |
24 | |
25 | my $args = { |
e70a1600 |
26 | schema => $self->schema, |
38bd9956 |
27 | }; |
28 | |
29 | $args->{to_version} = $self->to_version if $self->has_to_version; |
30 | DBIx::Class::DeploymentHandler::DatabaseToSchemaVersions->new($args); |
e70a1600 |
31 | } |
32 | |
33 | 1; |
34 | |
35 | __END__ |
36 | |
37 | vim: ts=2 sw=2 expandtab |