Skip to content

Commit

Permalink
handle "package NAME VERSION" - fix #113
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 25, 2019
1 parent 3b6f242 commit abeefce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Revision history for DBIx-Class-Migration.
- POD improvements - thanks @manwar
- use Log::Any for errors - thanks @upasana-me
- coerce target_dir to absolute to work right on 5.26+
- handle "package NAME VERSION" - thanks @kivilahtio for report

0.061 2019-02-25
- POD improvements - thanks @n7st and @willsheppard
Expand Down
11 changes: 8 additions & 3 deletions lib/DBIx/Class/Migration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ sub dbic_dh {
_log_die "A \$VERSION needs to be specified in your schema class ${\$self->_infer_schema_class}"
unless $self->schema->schema_version;


my $dh = $self->deployment_handler_class->new({
schema => $self->schema,
%dbic_dh_args, @args,
Expand All @@ -212,7 +211,9 @@ sub upgrade { shift->dbic_dh->upgrade }
sub downgrade {
my ($self, %args) = @_;
unless($self->dbic_dh_args->{to_version}) {
my $to_version = $self->dbic_dh->schema_version - 1;
my $to_version = $self->dbic_dh->schema_version;
$to_version = $to_version->numify if ref $to_version; # version object
$to_version -= 1;
warn "No to_version is specified, downgrading to version $to_version";
$args{to_version} = $to_version;
}
Expand Down Expand Up @@ -287,7 +288,11 @@ sub _create_all_fixture_set {
_create_file_at_path($path, $conf);
}

sub _has_previous_version { $_[0] ? $_[0]-1 : 0 }
sub _has_previous_version {
return 0 if !$_[0];
return $_[0]->numify - 1 if ref $_[0]; # version object
$_[0]-1
}

sub _only_from_when_not_to {
my ($from_dir, $to_dir) = @_;
Expand Down
4 changes: 1 addition & 3 deletions t/lib/Local/v2/Schema.pm
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package Local::v2::Schema;
package Local::v2::Schema 2;
use base 'DBIx::Class::Schema';

our $VERSION = 2;

__PACKAGE__->load_namespaces;

1;
Expand Down

0 comments on commit abeefce

Please sign in to comment.