Commit | Line | Data |
7d876442 |
1 | package DBIx::Class::DeploymentHandler::ProvideSchema::SchemaLoader; |
2 | |
3 | use Moose; |
4 | use DBIx::Class::Schema::Loader; |
5 | |
6 | with 'DBIx::Class::DeploymentHandler::HandlesProvideSchema'; |
7 | |
8 | has schema => (is=>'ro', required=>1); |
9 | |
10 | my %opts = ( |
11 | naming => { ALL => 'v7'}, |
12 | use_namespaces => 1, |
13 | debug => $ENV{DBIC_DEPLOYMENTHANDLER_DEBUG}||0); |
14 | |
15 | my $cnt = 0; |
16 | |
17 | sub migration_schema { |
18 | my $schema = shift->schema->clone; |
19 | my $name = ref($schema) . $cnt++; |
20 | DBIx::Class::Schema::Loader::make_schema_at |
21 | $name, \%opts, [ sub {$schema->storage->dbh} ]; |
22 | } |
23 | |
24 | 1; |
25 | |
26 | # vim: ts=2 sw=2 expandtab |
27 | |
28 | __END__ |
29 | |
30 | =method schema_for_run_files |
31 | |
32 | my $schema = $dh->schema_for_run_files; |
33 | |
34 | Provides a L<DBIx::Class::Schema> object that we can pass to the Perl deploy |
35 | scripts. We reverse engineer a C<$schema> from whatever is currently deployed |
36 | to the database using L<DBIx::Class::Schema::Loader> |