when running perl scripts in deploy, use a $schema that is generated from the current...
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / ProvideSchema / SchemaLoader.pm
CommitLineData
7d876442 1package DBIx::Class::DeploymentHandler::ProvideSchema::SchemaLoader;
2
3use Moose;
4use DBIx::Class::Schema::Loader;
5
6with 'DBIx::Class::DeploymentHandler::HandlesProvideSchema';
7
8has schema => (is=>'ro', required=>1);
9
10my %opts = (
11 naming => { ALL => 'v7'},
12 use_namespaces => 1,
13 debug => $ENV{DBIC_DEPLOYMENTHANDLER_DEBUG}||0);
14
15my $cnt = 0;
16
17sub 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
241;
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
34Provides a L<DBIx::Class::Schema> object that we can pass to the Perl deploy
35scripts. We reverse engineer a C<$schema> from whatever is currently deployed
36to the database using L<DBIx::Class::Schema::Loader>