[Dbix-class] $schema->ddl_filename() will potentially corrupt the
directory name
Byron Young
Byron.Young at riverbed.com
Fri Sep 26 00:57:05 BST 2008
If you pass a $preversion to ddl_filename(), it will update the filename with s/$version/$pversion-$version/ after it constructs the full filename. If your $dir happens to have something in it that matches $version, the directory will be corrupted and the filename won't be touched. Here's a patch to fix it.
-Byron
Index: lib/DBIx/Class/Schema.pm
===================================================================
--- lib/DBIx/Class/Schema.pm (revision 4850)
+++ lib/DBIx/Class/Schema.pm (working copy)
@@ -1208,8 +1208,12 @@
my $filename = ref($self);
$filename =~ s/::/-/g;
- $filename = File::Spec->catfile($dir, "$filename-$version-$type.sql");
- $filename =~ s/$version/$preversion-$version/ if($preversion);
+ if ($preversion) {
+ $filename = "$filename-$preversion-$version-$type.sql";
+ } else {
+ $filename = "$filename-$version-$type.sql";
+ }
+ $filename = File::Spec->catfile($dir, $filename);
return $filename;
}
More information about the DBIx-Class
mailing list