use Carp::Clan qw/^DBIx::Class/;
use Scalar::Util qw/weaken/;
-use File::Spec;
+use Path::Class;
use base qw/DBIx::Class/;
sub ddl_filename
{
- my ($self, $dir, $type, $version) = @_;
+ my ($self, $dir, $type, $version, $pversion) = @_;
my $filename = ref($self);
$filename =~ s/^.*:://;
- $filename = File::Spec->catpath($dir, "$filename-$version-$type.sql");
+ $filename = file($dir, "$filename-$version-$type.sql")->stringify;
+ $filename =~ s/$version/$pversion-$version/ if($pversion);
return $filename;
}
$target_schema, $db,
{}
);
- my $difffile = $filename;
- $difffile =~ s/$version/${preversion}-${version}/;
+ my $difffile = $schema->ddl_filename($dir, $db, $version, $preversion);
if(-e $difffile)
{
warn("$difffile already exists, skipping");
}
}
+sub backup
+{
+ my ($self) = @_;
+
+ ## Does nothing, override in DBI::XX classes
+}
+
sub DESTROY { shift->disconnect }
1;