From: Peter Rabbitson Date: Mon, 31 May 2010 17:35:31 +0000 (+0000) Subject: Fix RT#57732 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2373739375a4e798158a5d483d9b9264fa9c0c71;p=dbsrgits%2FDBIx-Class-Historic.git Fix RT#57732 --- diff --git a/lib/DBIx/Class/Admin.pm b/lib/DBIx/Class/Admin.pm index 366bf25..89766ba 100644 --- a/lib/DBIx/Class/Admin.pm +++ b/lib/DBIx/Class/Admin.pm @@ -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; } diff --git a/t/admin/02ddl.t b/t/admin/02ddl.t index 81ea5f8..e3ac33a 100644 --- a/t/admin/02ddl.t +++ b/t/admin/02ddl.t @@ -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', diff --git a/t/lib/DBICVersion_v1.pm b/t/lib/DBICVersion_v1.pm index 56c01e2..ee34628 100644 --- a/t/lib/DBICVersion_v1.pm +++ b/t/lib/DBICVersion_v1.pm @@ -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'); diff --git a/t/lib/DBICVersion_v2.pm b/t/lib/DBICVersion_v2.pm index b6508ca..3c5624b 100644 --- a/t/lib/DBICVersion_v2.pm +++ b/t/lib/DBICVersion_v2.pm @@ -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;