From: Jess Robinson Date: Fri, 19 May 2006 08:38:07 +0000 (+0000) Subject: Backups and Path::Class X-Git-Tag: v0.08240~406^2~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=200427a4ade2f01d3a145b67ce8e8dca6d98af02;p=dbsrgits%2FDBIx-Class.git Backups and Path::Class --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 40caff6..8297e3f 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -5,7 +5,7 @@ use warnings; use Carp::Clan qw/^DBIx::Class/; use Scalar::Util qw/weaken/; -use File::Spec; +use Path::Class; use base qw/DBIx::Class/; @@ -785,11 +785,12 @@ format. 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; } diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 552794d..31b3ed8 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -811,8 +811,7 @@ sub create_ddl_dir $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"); @@ -876,6 +875,13 @@ sub deploy { } } +sub backup +{ + my ($self) = @_; + + ## Does nothing, override in DBI::XX classes +} + sub DESTROY { shift->disconnect } 1;