X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FBase.pm;h=8f90282b7a902b0cb7ec741ed8ad704e1e13fdc1;hb=af99957c31fb7725daa2db213388c7ddd99fab71;hp=d3599360ff26f999503e754d2443694c8066bffa;hpb=70b72fabc744cfcd0939fcba8c57e146df30eecf;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index d359936..8f90282 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -14,7 +14,7 @@ use Cwd qw//; use Digest::MD5 qw//; require DBIx::Class; -our $VERSION = '0.04001'; +our $VERSION = '0.04999_01'; __PACKAGE__->mk_ro_accessors(qw/ schema @@ -352,9 +352,9 @@ sub rescan { } } - $self->_load_tables(@created); + my $loaded = $self->_load_tables(@created); - return map { $self->monikers->{$_} } @created; + return map { $self->monikers->{$_} } @$loaded; } sub _load_tables { @@ -399,7 +399,7 @@ sub _load_tables { # Drop temporary cache delete $self->{_cache}; - 1; + return \@tables; } sub _get_dump_filename { @@ -471,7 +471,7 @@ sub _write_classfile { my $custom_content = $self->_get_custom_content($class, $filename); - $custom_content ||= qq|\n# You can replace this text with custom| + $custom_content ||= qq|\n\n# You can replace this text with custom| . qq| content, and it will be preserved on regeneration| . qq|\n1;\n|; @@ -487,7 +487,7 @@ sub _write_classfile { or croak "Cannot open '$filename' for writing: $!"; # Write the top half and its MD5 sum - print $fh $text . Digest::MD5::md5_base64($text) . "\n\n"; + print $fh $text . Digest::MD5::md5_base64($text) . "\n"; # Write out anything loaded via external partial class file in @INC print $fh qq|$_\n| @@ -666,9 +666,10 @@ sub _load_relationships { $fkdef->{remote_source} = $self->monikers->{delete $fkdef->{remote_table}}; } + my $tbl_uniq_info = $self->_table_uniq_info($table); my $local_moniker = $self->monikers->{$table}; - my $rel_stmts = $self->{relbuilder}->generate_code($local_moniker, $tbl_fk_info); + my $rel_stmts = $self->{relbuilder}->generate_code($local_moniker, $tbl_fk_info, $tbl_uniq_info); foreach my $src_class (sort keys %$rel_stmts) { my $src_stmts = $rel_stmts->{$src_class};