From: Robert Bohne Date: Fri, 19 Feb 2010 06:48:56 +0000 (+0100) Subject: Merge branch 'master' into custom_column_info X-Git-Tag: 0.05003~5^2~1^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8084e0a29e1b42fd6d3150d6ece51b621cc01f46;hp=23d1f36b238acbceaa1ecd71743ce4f5b8e8fd7e;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Merge branch 'master' into custom_column_info --- diff --git a/Changes b/Changes index 1a41b81..128d6f0 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - fix missing trailing _id stripping for some relationship + names (rbuels) + - fixed accessor POD bug, was not dereferencing scalar refs + before printing (rbuels) + 0.05002 2010-02-15 10:17:47 - support for SQLAnywhere via DBD::SQLAnywhere and ODBC - fix picking up quoted tables for SQLite (RT#54538) patch from schwern diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index c93fa90..4f57523 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -1545,9 +1545,11 @@ sub _make_pod { $self->_pod( $class, join "\n", map { my $s = $attrs->{$_}; - $s = !defined $s ? 'undef' : - length($s) == 0 ? '(empty string)' : - $s; + $s = !defined $s ? 'undef' : + length($s) == 0 ? '(empty string)' : + ref($s) eq 'SCALAR' ? $$s : + $s + ; " $_: $s" } sort keys %$attrs, diff --git a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm index 57c5392..4121f64 100644 --- a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm +++ b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm @@ -247,10 +247,16 @@ sub generate_code { # col names to distinguish if($counters{$remote_moniker} > 1) { my $colnames = q{_} . join(q{_}, @$local_cols); - $local_relname = $self->_inflect_plural( - lc($local_table) . $colnames - ); + my $old_relname = #< TODO: remove me after 0.05003 release + $local_relname = lc($local_table) . $colnames; + my $stripped_id = $local_relname =~ s/_id$//; #< strip off any trailing _id + $local_relname = $self->_inflect_plural( $local_relname ); $remote_relname .= $colnames if keys %cond > 1; + + # TODO: remove me after 0.05003 release + $old_relname = $self->_inflect_plural( $old_relname ); + warn __PACKAGE__." $VERSION: warning, stripping trailing _id from ${remote_class} relation '$old_relname', renaming to '$local_relname'. This behavior is new as of 0.05003.\n" + if $stripped_id; } else { $local_relname = $self->_inflect_plural(lc $local_table); } diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index b209fe8..478cf52 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -173,6 +173,8 @@ sub setup_schema { $warn_count++ for grep /^Bad table or view/, @loader_warnings; + $warn_count++ for grep /stripping trailing _id/, @loader_warnings; + my $vendor = $self->{vendor}; $warn_count++ for grep /${vendor}_\S+ has no primary key/, @loader_warnings;