[Bast-commits] r8206 - branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader

rbuels at dev.catalyst.perl.org rbuels at dev.catalyst.perl.org
Thu Dec 31 21:15:06 GMT 2009


Author: rbuels
Date: 2009-12-31 21:15:05 +0000 (Thu, 31 Dec 2009)
New Revision: 8206

Modified:
   branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
Log:
added overwrite_modifications option (default off), which causes Loader to ignore the md5sum of generated code and overwrite it anyway

Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm	2009-12-31 20:08:30 UTC (rev 8205)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm	2009-12-31 21:15:05 UTC (rev 8206)
@@ -44,6 +44,7 @@
                                 default_resultset_class
                                 schema_base_class
                                 result_base_class
+				overwrite_modifications
 
                                 db_schema
                                 _tables
@@ -291,6 +292,19 @@
 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 @@
 
             $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 = '';
         }




More information about the Bast-commits mailing list