From: Arthur Axel 'fREW' Schmidt Date: Sun, 21 Mar 2010 08:14:09 +0000 (-0500) Subject: none of these should happen thanks to how things work now X-Git-Tag: v0.001000_01~58 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aabd4237190bfe45a6bea6387baf9d7c301357d2;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git none of these should happen thanks to how things work now --- diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index f9fa53c..41cc623 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -59,6 +59,7 @@ has databases => ( has _filedata => ( isa => 'ArrayRef[Str]', is => 'rw', + default => sub { [] }, ); has txn_wrap => ( @@ -339,7 +340,7 @@ method _prepare_changegrade($from_version, $to_version, $version_set, $direction method _read_sql_file($file) { return unless $file; - open my $fh, '<', $file or carp("Can't open sql file, $file ($!)"); + open my $fh, '<', $file; my @data = split /;\n/, join '', <$fh>; close $fh; @@ -363,12 +364,6 @@ sub _downgrade_single_step { )}; for my $downgrade_file (@downgrade_files) { - unless (-f $downgrade_file) { - # croak? - carp "Downgrade not possible, no downgrade file found ($downgrade_file), please create one\n"; - return; - } - $self->_filedata($self->_read_sql_file($downgrade_file)); # I don't like this --fREW 2010-02-22 my $guard = $self->schema->txn_scope_guard if $self->txn_wrap; @@ -386,12 +381,6 @@ sub _upgrade_single_step { )}; for my $upgrade_file (@upgrade_files) { - unless (-f $upgrade_file) { - # croak? - carp "Upgrade not possible, no upgrade file found ($upgrade_file), please create one\n"; - return; - } - $self->_filedata($self->_read_sql_file($upgrade_file)); # I don't like this --fREW 2010-02-22 my $guard = $self->schema->txn_scope_guard if $self->txn_wrap; $self->_do_upgrade; @@ -402,7 +391,6 @@ sub _upgrade_single_step { method _do_upgrade { $self->_run_upgrade(qr/.*?/) } method _run_upgrade($stm) { - return unless $self->_filedata; my @statements = grep { $_ =~ $stm } @{$self->_filedata}; for (@statements) { @@ -417,6 +405,8 @@ method _apply_statement($statement) { $self->storage->dbh->do($_) or carp "SQL was: $_" } +__PACKAGE__->meta->make_immutable; + 1; __END__