X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=d35b21116f7b5800f288eda21151f85f8f3c2305;hb=824f4422ff33f9e1052507e613f7b9086f5c3103;hp=7926e92c4f58a9d7e3c46d8b9a5bb129815238d6;hpb=f32eb113ef8eeecae466e2e950382bc4f7c5469d;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 7926e92..d35b211 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -390,6 +390,8 @@ sub compose_namespace { $target_class => $source->result_class, ($base ? $base : ()) ); $source->result_class($target_class); + $target_class->result_source_instance($source) + if $target_class->can('result_source_instance'); } } Class::C3->reinitialize(); @@ -555,6 +557,8 @@ context and it will behave as expected. sub txn_do { my ($self, $coderef, @args) = @_; + $self->storage or $self->throw_exception + ('txn_do called on $schema without storage'); ref $coderef eq 'CODE' or $self->throw_exception ('$coderef must be a CODE reference'); @@ -621,7 +625,9 @@ copy. sub clone { my ($self) = @_; - my $clone = bless({ (ref $self ? %$self : ()) }, ref $self || $self); + my $clone = { (ref $self ? %$self : ()) }; + bless $clone, (ref $self || $self); + foreach my $moniker ($self->sources) { my $source = $self->source($moniker); my $new = $source->new($source); @@ -697,6 +703,10 @@ Attempts to deploy the schema to the current storage using L. Note that this feature is currently EXPERIMENTAL and may not work correctly across all databases, or fully handle complex relationships. +See L for a list of values for C<$sqlt_args>. The most +common value for this would be C<< { add_drop_table => 1, } >> to have the SQL +produced include a DROP TABLE statement for each table created. + =cut sub deploy { @@ -743,7 +753,7 @@ sub ddl_filename my ($self, $type, $dir, $version) = @_; my $filename = ref($self); - $filename =~ s/^.*:://; + $filename =~ s/::/-/; $filename = "$dir$filename-$version-$type.sql"; return $filename;