0.04002 - disable oracle.pm indexing and fix rescan return values
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / Base.pm
index b617697..a723beb 100644 (file)
@@ -14,7 +14,7 @@ use Cwd qw//;
 use Digest::MD5 qw//;
 require DBIx::Class;
 
-our $VERSION = '0.03999_02';
+our $VERSION = '0.04002';
 
 __PACKAGE__->mk_ro_accessors(qw/
                                 schema
@@ -34,6 +34,7 @@ __PACKAGE__->mk_ro_accessors(qw/
                                 debug
                                 dump_directory
                                 dump_overwrite
+                                really_erase_my_files
 
                                 db_schema
                                 _tables
@@ -162,6 +163,11 @@ recommended way to access this functionality.
 
 =head2 dump_overwrite
 
+Deprecated.  See L</really_erase_my_files> below, which does *not* mean
+the same thing as the old C<dump_overwrite> setting from previous releases.
+
+=head2 really_erase_my_files
+
 Default false.  If true, Loader will unconditionally delete any existing
 files before creating the new ones from scratch when dumping a schema to disk.
 
@@ -170,11 +176,15 @@ file, up to and including the final stanza which contains
 C<# DO NOT MODIFY THIS OR ANYTHING ABOVE!>
 leaving any customizations you placed after that as they were.
 
-When C<dump_overwrite> is not set, if the output file already exists,
+When C<really_erase_my_files> is not set, if the output file already exists,
 but the aforementioned final stanza is not found, or the checksum
 contained there does not match the generated contents, Loader will
 croak and not touch the file.
 
+You should really be using version control on your schema classes (and all
+of the rest of your code for that matter).  Don't blame me if a bug in this
+code wipes something out when it shouldn't have, you've been warned.
+
 =head1 METHODS
 
 None of these methods are intended for direct invocation by regular
@@ -225,6 +235,10 @@ sub new {
     $self->{schema_class} ||= ( ref $self->{schema} || $self->{schema} );
     $self->{schema} ||= $self->{schema_class};
 
+    croak "dump_overwrite is deprecated.  Please read the"
+        . " DBIx::Class::Schema::Loader::Base documentation"
+            if $self->{dump_overwrite};
+
     $self->{relbuilder} = DBIx::Class::Schema::Loader::RelBuilder->new(
         $self->schema_class, $self->inflect_plural, $self->inflect_singular
     ) if !$self->{skip_relationships};
@@ -292,7 +306,7 @@ sub _load_external {
         $self->_ext_stmt($class, $_);
     }
     $self->_ext_stmt($class,
-        q|# End of lines loaded from '$real_inc_path' |
+        qq|# End of lines loaded from '$real_inc_path' |
     );
     close($fh)
         or croak "Failed to close $real_inc_path: $!";
@@ -338,9 +352,9 @@ sub rescan {
         }
     }
 
-    $self->_load_tables(@created);
+    my $loaded = $self->_load_tables(@created);
 
-    return map { $self->monikers->{$_} } @created;
+    return map { $self->monikers->{$_} } @$loaded;
 }
 
 sub _load_tables {
@@ -385,7 +399,7 @@ sub _load_tables {
     # Drop temporary cache
     delete $self->{_cache};
 
-    1;
+    return \@tables;
 }
 
 sub _get_dump_filename {
@@ -449,9 +463,9 @@ sub _write_classfile {
     my $filename = $self->_get_dump_filename($class);
     $self->_ensure_dump_subdirs($class);
 
-    if (-f $filename && $self->dump_overwrite) {
+    if (-f $filename && $self->really_erase_my_files) {
         warn "Deleting existing file '$filename' due to "
-            . "'dump_overwrite' setting\n";
+            . "'really_erase_my_files' setting\n";
         unlink($filename);
     }    
 
@@ -511,7 +525,7 @@ sub _get_custom_content {
         }
     }
 
-    croak "Cannot not overwrite '$filename' without 'dump_overwrite',"
+    croak "Cannot not overwrite '$filename' without 'really_erase_my_files',"
         . " it does not appear to have been generated by Loader"
             if !$found;