Merge branch 'master' into 0.08
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / Base.pm
index 42e2fa4..7f72358 100644 (file)
@@ -24,7 +24,7 @@ use Try::Tiny;
 use DBIx::Class ();
 use namespace::clean;
 
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
 
 __PACKAGE__->mk_group_ro_accessors('simple', qw/
                                 schema
@@ -132,7 +132,7 @@ overwriting a dump made with an earlier version.
 
 The option also takes a hashref:
 
-    naming => { relationships => 'v7', monikers => 'v7' }
+    naming => { relationships => 'v8', monikers => 'v8' }
 
 The keys are:
 
@@ -194,6 +194,11 @@ transition instead of just being lowercased, so C<FooId> becomes C<foo_id>.
 If you don't have any CamelCase table or column names, you can upgrade without
 breaking any of your code.
 
+=item v8
+
+This mode tries harder to not have collisions between column accessors and
+belongs_to relationship accessors.
+
 =back
 
 Dynamic schemas will always default to the 0.04XXX relationship names and won't
@@ -202,10 +207,10 @@ and singularization put this in your C<Schema.pm> file:
 
     __PACKAGE__->naming('current');
 
-Or if you prefer to use 0.07XXX features but insure that nothing breaks in the
+Or if you prefer to use 0.08XXX features but insure that nothing breaks in the
 next major version upgrade:
 
-    __PACKAGE__->naming('v7');
+    __PACKAGE__->naming('v8');
 
 =head2 generate_pod
 
@@ -490,7 +495,7 @@ L<DBIx::Class::Schema::Loader>.
 
 =cut
 
-my $CURRENT_V = 'v7';
+my $CURRENT_V = 'v8';
 
 my @CLASS_ARGS = qw(
     schema_base_class result_base_class additional_base_classes
@@ -1006,6 +1011,15 @@ sub _relbuilder {
              $self->relationship_attrs,
         );
     }
+    elsif ($self->naming->{relationships} eq 'v6') {
+        require DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_07;
+        return $self->{relbuilder} ||= DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_07->new (
+             $self->schema,
+             $self->inflect_plural,
+             $self->inflect_singular,
+             $self->relationship_attrs,
+        );
+    }
 
     return $self->{relbuilder} ||= DBIx::Class::Schema::Loader::RelBuilder->new (
              $self->schema,