more complete backcompat tests, one last thing to do
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader.pm
index 2aab638..4f55c89 100644 (file)
@@ -10,10 +10,12 @@ use Scalar::Util qw/ weaken /;
 # 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.04999_11';
+our $VERSION = '0.04999_12';
 
 __PACKAGE__->mk_classaccessor('_loader_args' => {});
-__PACKAGE__->mk_classaccessors(qw/dump_to_dir _loader_invoked _loader loader_class/);
+__PACKAGE__->mk_classaccessors(qw/
+    dump_to_dir _loader_invoked _loader loader_class naming
+/);
 
 =head1 NAME
 
@@ -150,6 +152,7 @@ sub _invoke_loader {
     $args->{schema_class} = $class;
     weaken($args->{schema}) if ref $self;
     $args->{dump_directory} ||= $self->dump_to_dir;
+    $args->{naming} = $self->naming if $self->naming;
 
     # XXX this only works for relative storage_type, like ::DBI ...
     my $impl = $self->loader_class
@@ -285,16 +288,23 @@ Examples:
 
 sub import {
     my $self = shift;
+
     return if !@_;
+
+    my $cpkg = (caller)[0];
+
     foreach my $opt (@_) {
         if($opt =~ m{^dump_to_dir:(.*)$}) {
             $self->dump_to_dir($1)
         }
         elsif($opt eq 'make_schema_at') {
             no strict 'refs';
-            my $cpkg = (caller)[0];
             *{"${cpkg}::make_schema_at"} = \&make_schema_at;
         }
+        elsif($opt eq 'naming') {
+            no strict 'refs';
+            *{"${cpkg}::naming"} = sub { $self->naming(@_) };
+        }
     }
 }
 
@@ -370,6 +380,24 @@ Returns a list of the new monikers added.
 
 sub rescan { my $self = shift; $self->_loader->rescan($self) }
 
+=head2 naming
+
+=over 4
+
+=item Arguments: \%opts | $ver
+
+=back
+
+Controls the naming options for backward compatibility, see
+L<DBIx::Class::Schema::Loader::Base/naming> for details.
+
+To upgrade a dynamic schema, use:
+
+    __PACKAGE__->naming('current');
+
+Can be imported into your dump script and called as a function as well:
+
+    naming('v4');
 
 =head1 KNOWN ISSUES
 
@@ -423,7 +451,11 @@ gugu: Andrey Kostenko <a.kostenko@rambler-co.ru>
 ... and lots of other folks. If we forgot you, please write the current
 maintainer or RT.
 
-=head1 LICENSE
+=head1 COPYRIGHT & LICENSE
+
+Copyright (c) 2006 - 2009 by the aforementioned
+L<DBIx::Class::Schema::Loader/AUTHOR> and
+L<DBIx::Class::Schema::Loader/CONTRIBUTORS>.
 
 This library is free software; you can redistribute it and/or modify it under
 the same terms as Perl itself.