X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=3ce1c1cd1c0f15c0a38d64aaed059e6ea9040c22;hb=cb6ec758e3c4607ec8e30dd943a500a1d70d8940;hp=ae0c4278951c335043b921cb571b749ddcfda2e7;hpb=adb3554a3f72bf9c9b267c5eb84a8401da64bf37;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index ae0c427..3ce1c1c 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -14,6 +14,7 @@ use base qw/DBIx::Class/; __PACKAGE__->mk_classdata('class_mappings' => {}); __PACKAGE__->mk_classdata('source_registrations' => {}); __PACKAGE__->mk_classdata('storage_type' => '::DBI'); +__PACKAGE__->mk_classdata('storage_type_args' => {}); __PACKAGE__->mk_classdata('storage'); __PACKAGE__->mk_classdata('exception_action'); __PACKAGE__->mk_classdata('stacktrace' => $ENV{DBIC_TRACE} || 0); @@ -682,7 +683,7 @@ sub connection { $self->throw_exception( "No arguments to load_classes and couldn't load ${storage_class} ($@)" ) if $@; - my $storage = $storage_class->new($self); + my $storage = $storage_class->new($self, $self->storage_type_args); $storage->connect_info(\@info); $self->storage($storage); return $self; @@ -1038,6 +1039,30 @@ sub deploy { $self->storage->deploy($self, undef, $sqltargs, $dir); } +=head2 deployment_statements + +=over 4 + +=item Arguments: $rdbms_type + +=back + +Returns the SQL statements used by L and L. +C<$rdbms_type> provides the DBI database driver name for which the SQL +statements are produced. If not supplied, the type of the current schema storage +will be used. + +=cut + +sub deployment_statements { + my ($self, $rdbms_type) = @_; + + $self->throw_exception("Can't generate deployment statements without a storage") + if not $self->storage; + + $self->storage->deployment_statements($self, $rdbms_type); +} + =head2 create_ddl_dir (EXPERIMENTAL) =over 4