# Always remember to do all digits for the version even if they're 0
# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
# brain damage and presumably various other packaging systems too
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
__PACKAGE__->mk_group_accessors('inherited', qw/
_loader_args
require DBIx::Class;
use namespace::clean;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
__PACKAGE__->mk_group_ro_accessors('simple', qw/
schema
The option also takes a hashref:
- naming => { relationships => 'v7', monikers => 'v7' }
+ naming => { relationships => 'v8', monikers => 'v8' }
The keys are:
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
__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
=cut
-my $CURRENT_V = 'v7';
+my $CURRENT_V = 'v8';
my @CLASS_ARGS = qw(
schema_base_class result_base_class additional_base_classes
$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,
use Class::C3;
use Carp::Clan qw/^DBIx::Class/;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use warnings;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Scalar::Util 'looks_like_number';
use namespace::clean;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use List::Util 'first';
use namespace::clean;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
/;
use Carp::Clan qw/^DBIx::Class/;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Text::Balanced qw( extract_bracketed );
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
package DBIx::Class::Schema::Loader::DBI::Writing;
use strict;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
# Empty. POD only.
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
use Lingua::EN::Inflect::Phrase ();
use DBIx::Class::Schema::Loader::Utils 'split_name';
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
=head1 NAME
return \%composite;
}
+sub _strip__id {
+ my ($self, $name) = @_;
+
+ $name =~ s/_(?:id|ref)\z//;
+
+ return $name;
+}
+
sub _array_eq {
my ($self, $a, $b) = @_;
if(scalar keys %{$cond} == 1) {
my ($col) = values %{$cond};
$col = $self->_normalize_name($col);
- $col =~ s/_id$//;
+ $col = $self->_strip__id($col);
$remote_relname = $self->_inflect_singular($col);
}
else {
$remote_relname .= $colnames if keys %$cond > 1;
$local_relname = $self->_normalize_name($local_table . $colnames);
- $local_relname =~ s/_id$//;
+ $local_relname = $self->_strip__id($local_relname);
$local_relname_uninflected = $local_relname;
$local_relname = $self->_inflect_plural($local_relname);
use Carp::Clan qw/^DBIx::Class/;
use Lingua::EN::Inflect::Number ();
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
sub _relnames_and_method {
my ( $self, $local_moniker, $rel, $cond, $uniqs, $counters ) = @_;
use Carp::Clan qw/^DBIx::Class/;
use Lingua::EN::Inflect::Number ();
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
sub _to_PL {
my ($self, $name) = @_;
use strict;
use warnings;
use Class::C3;
-use base 'DBIx::Class::Schema::Loader::RelBuilder';
+use base 'DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_07';
use Carp::Clan qw/^DBIx::Class/;
-use Lingua::EN::Inflect::Phrase ();
-our $VERSION = '0.07001';
+our $VERSION = '0.08000';
sub _normalize_name {
my ($self, $name) = @_;
=head1 NAME
DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_06 - RelBuilder for
-compatibility with DBIx::Class::Schema::Loader version 0.06001
+compatibility with DBIx::Class::Schema::Loader version 0.06000
=head1 DESCRIPTION
--- /dev/null
+package DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_07;
+
+use strict;
+use warnings;
+use Class::C3;
+use base 'DBIx::Class::Schema::Loader::RelBuilder';
+use Carp::Clan qw/^DBIx::Class/;
+
+our $VERSION = '0.08000';
+
+sub _strip__id {
+ my ($self, $name) = @_;
+
+ $name =~ s/_id\z//;
+
+ return $name;
+}
+
+=head1 NAME
+
+DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_07 - RelBuilder for
+compatibility with DBIx::Class::Schema::Loader version 0.07000
+
+=head1 DESCRIPTION
+
+See L<DBIx::Class::Schema::Loader::Base/naming> and
+L<DBIx::Class::Schema::Loader::RelBuilder>.
+
+=head1 AUTHOR
+
+See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>.
+
+=head1 LICENSE
+
+This library is free software; you can redistribute it and/or modify it under
+the same terms as Perl itself.
+
+=cut
+
+1;
+# vim:et sts=4 sw=4 tw=0: