From: Robert Buels Date: Thu, 31 Dec 2009 21:15:05 +0000 (+0000) Subject: added overwrite_modifications option (default off), which causes Loader to ignore... X-Git-Tag: 0.04999_13~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=639a13673780d467811f98dc678c226e4cb71a63;p=dbsrgits%2FDBIx-Class-Schema-Loader.git added overwrite_modifications option (default off), which causes Loader to ignore the md5sum of generated code and overwrite it anyway --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index c2772f7..b3a7376 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -44,6 +44,7 @@ __PACKAGE__->mk_group_ro_accessors('simple', qw/ default_resultset_class schema_base_class result_base_class + overwrite_modifications db_schema _tables @@ -291,6 +292,19 @@ 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. +=head2 overwrite_modifications + +Default false. If false, when updating existing files, Loader will +refuse to modify any Loader-generated code that has been modified +since its last run (as determined by the checksum Loader put in its +comment lines). + +If true, Loader will discard any manual modifications that have been +made to Loader-generated code. + +Again, you should be using version control on your schema classes. Be +careful with this option. + =head1 METHODS None of these methods are intended for direct invocation by regular @@ -948,7 +962,7 @@ sub _get_custom_content { $buffer .= $line; croak "Checksum mismatch in '$filename'" - if Digest::MD5::md5_base64($buffer) ne $md5; + if !$self->overwrite_modifications && Digest::MD5::md5_base64($buffer) ne $md5; $buffer = ''; }