use Digest::MD5 qw//;
require DBIx::Class;
-our $VERSION = '0.03999_01';
+our $VERSION = '0.04002';
__PACKAGE__->mk_ro_accessors(qw/
schema
debug
dump_directory
dump_overwrite
+ really_erase_my_files
db_schema
_tables
=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.
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
$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};
$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: $!";
}
}
- $self->_load_tables(@created);
+ my $loaded = $self->_load_tables(@created);
- return map { $self->monikers->{$_} } @created;
+ return map { $self->monikers->{$_} } @$loaded;
}
sub _load_tables {
# Drop temporary cache
delete $self->{_cache};
- 1;
+ return \@tables;
}
sub _get_dump_filename {
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);
}
}
}
- 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;