dump_directory
dump_overwrite
really_erase_my_files
- use_namespaces
result_namespace
resultset_namespace
default_resultset_class
version_to_dump
schema_version_to_dump
_upgrading_from
+ _upgrading_from_load_classes
+ use_namespaces
/);
=head1 NAME
---------------------------
luser | Luser
luser_group | LuserGroup
- luser-opts | LuserOpts
+ luser-opts | LuserOpt
=head2 inflect_plural
=head2 use_namespaces
+This is now the default, to go back to L<DBIx::Class::Schema/load_classes> pass
+a C<0>.
+
Generate result class names suitable for
L<DBIx::Class::Schema/load_namespaces> and call that instead of
L<DBIx::Class::Schema/load_classes>. When using this option you can also
$self->_check_back_compat;
+ $self->use_namespaces(1) unless defined $self->use_namespaces;
+
$self;
}
Set the 'naming' attribute or the SCHEMA_LOADER_BACKCOMPAT environment variable
to disable this warning.
+Also consider setting 'use_namespaces => 1' if/when upgrading.
+
See perldoc DBIx::Class::Schema::Loader::Manual::UpgradingFromV4 for more
details.
EOF
$self->naming->{relationships} ||= 'v4';
$self->naming->{monikers} ||= 'v4';
+ if ($self->use_namespaces) {
+ $self->_upgrading_from_load_classes(1);
+ }
+ else {
+ $self->use_namespaces(0);
+ }
+
return;
}
open(my $fh, '<', $filename)
or croak "Cannot open '$filename' for reading: $!";
+ my $load_classes = 0;
+
while (<$fh>) {
- if (/^# Created by DBIx::Class::Schema::Loader v((\d+)\.(\d+))/) {
- my $real_ver = $1;
+ if (/^__PACKAGE__->load_classes;/) {
+ $load_classes = 1;
+ } elsif (my ($real_ver) =
+ /^# Created by DBIx::Class::Schema::Loader v(\d+\.\d+)/) {
+
+ if ($load_classes && (not defined $self->use_namespaces)) {
+ warn <<"EOF" unless $ENV{SCHEMA_LOADER_BACKCOMPAT};
+
+'load_classes;' static schema detected, turning off 'use_namespaces'.
+
+Set the 'use_namespaces' attribute or the SCHEMA_LOADER_BACKCOMPAT environment
+variable to disable this warning.
+
+See perldoc DBIx::Class::Schema::Loader::Manual::UpgradingFromV4 for more
+details.
+EOF
+ $self->use_namespaces(0);
+ }
+ elsif ($load_classes && $self->use_namespaces) {
+ $self->_upgrading_from_load_classes(1);
+ }
# XXX when we go past .0 this will need fixing
my ($v) = $real_ver =~ /([1-9])/;
.qq|# for you to hand-edit. If you do not either delete\n|
.qq|# this section or remove that file from \@INC, this section\n|
.qq|# will be repeated redundantly when you re-create this\n|
- .qq|# file again via Loader!\n|
+ .qq|# file again via Loader! See skip_load_external to disable\n|
+ .qq|# this feature.\n|
);
chomp $code;
$self->_ext_stmt($class, $code);
# These lines were loaded from '$old_real_inc_path',
# based on the Result class name that would have been created by an 0.04006
# version of the Loader. For a static schema, this happens only once during
-# upgrade.
+# upgrade. See skip_load_external to disable this feature.
EOF
my $code = do {
}
my $table_class = join(q{::}, @result_namespace, $table_moniker);
- if (my $upgrading_v = $self->_upgrading_from) {
- local $self->naming->{monikers} = $upgrading_v;
+ if ((my $upgrading_v = $self->_upgrading_from)
+ || $self->_upgrading_from_load_classes) {
+ local $self->naming->{monikers} = $upgrading_v
+ if $upgrading_v;
+
+ my @result_namespace = @result_namespace;
+ @result_namespace = ($schema_class)
+ if $self->_upgrading_from_load_classes;
my $old_class = join(q{::}, @result_namespace,
$self->_table2moniker($table));