Fix RT#57732
Peter Rabbitson [Mon, 31 May 2010 17:35:31 +0000 (17:35 +0000)]
lib/DBIx/Class/Admin.pm
t/admin/02ddl.t
t/lib/DBICVersion_v1.pm
t/lib/DBICVersion_v2.pm

index 366bf25..89766ba 100644 (file)
@@ -353,6 +353,7 @@ sub upgrade {
     # schema is unversioned
     $schema->throw_exception ("Could not determin current schema version, please either install() or deploy().\n");
   } else {
+    $schema->upgrade_directory ($self->sql_dir) if $self->sql_dir;  # this will override whatever default the schema has
     my $ret = $schema->upgrade();
     return $ret;
   }
index 81ea5f8..e3ac33a 100644 (file)
@@ -51,12 +51,6 @@ lives_ok {
 
 { # upgrade schema
 
-#my $schema = DBICTest->init_schema(
-#  no_deploy    => 1,
-#  no_populat    => 1,
-#  sqlite_use_file  => 1,
-#);
-
 clean_dir($sql_dir);
 require DBICVersion_v1;
 
@@ -78,6 +72,7 @@ is($schema->get_db_version, $DBICVersion::Schema::VERSION, 'Schema deployed and
 
 
 require DBICVersion_v2;
+DBICVersion::Schema->upgrade_directory (undef);  # so that we can test use of $sql_dir
 
 $admin = DBIx::Class::Admin->new(
   schema_class => 'DBICVersion::Schema',
index 56c01e2..ee34628 100644 (file)
@@ -36,11 +36,7 @@ our $VERSION = '1.0';
 
 __PACKAGE__->register_class('Table', 'DBICVersion::Table');
 __PACKAGE__->load_components('+DBIx::Class::Schema::Versioned');
-
-sub upgrade_directory
-{
-    return 't/var/';
-}
+__PACKAGE__->upgrade_directory('t/var/');
 
 sub ordered_schema_versions {
   return('1.0','2.0','3.0');
index b6508ca..3c5624b 100644 (file)
@@ -47,9 +47,4 @@ __PACKAGE__->load_components('+DBIx::Class::Schema::Versioned');
 __PACKAGE__->upgrade_directory('t/var/');
 __PACKAGE__->backup_directory('t/var/backup/');
 
-#sub upgrade_directory
-#{
-#    return 't/var/';
-#}
-
 1;