X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-DeploymentHandler.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FProvideSchema%2FSchemaLoader.pm;fp=lib%2FDBIx%2FClass%2FDeploymentHandler%2FProvideSchema%2FSchemaLoader.pm;h=b8ac00fee7c02f63e2b6669faaec73f014d5c205;hp=0000000000000000000000000000000000000000;hb=7d876442f151bedf8bcf7d594f30d58f6dad8b59;hpb=eb701ec6f072186383fcd7d6293a89eca85bfd48 diff --git a/lib/DBIx/Class/DeploymentHandler/ProvideSchema/SchemaLoader.pm b/lib/DBIx/Class/DeploymentHandler/ProvideSchema/SchemaLoader.pm new file mode 100644 index 0000000..b8ac00f --- /dev/null +++ b/lib/DBIx/Class/DeploymentHandler/ProvideSchema/SchemaLoader.pm @@ -0,0 +1,36 @@ +package DBIx::Class::DeploymentHandler::ProvideSchema::SchemaLoader; + +use Moose; +use DBIx::Class::Schema::Loader; + +with 'DBIx::Class::DeploymentHandler::HandlesProvideSchema'; + +has schema => (is=>'ro', required=>1); + +my %opts = ( + naming => { ALL => 'v7'}, + use_namespaces => 1, + debug => $ENV{DBIC_DEPLOYMENTHANDLER_DEBUG}||0); + +my $cnt = 0; + +sub migration_schema { + my $schema = shift->schema->clone; + my $name = ref($schema) . $cnt++; + DBIx::Class::Schema::Loader::make_schema_at + $name, \%opts, [ sub {$schema->storage->dbh} ]; +} + +1; + +# vim: ts=2 sw=2 expandtab + +__END__ + +=method schema_for_run_files + + my $schema = $dh->schema_for_run_files; + +Provides a L object that we can pass to the Perl deploy +scripts. We reverse engineer a C<$schema> from whatever is currently deployed +to the database using L