https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37895

Jonathan Druart <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #20 from Jonathan Druart <[email protected]> ---
I've lost track of this, sorry. I am not sure it's INVALID.

Why not iterating again?

Why not simply rethrowing the exception?

use Modern::Perl;
use Try::Tiny;
use Koha::Installer::Output qw(say_warning say_failure say_success say_info);

return {
    bug_number  => "12345",
    description => "Do stuffs with biblios",
    up          => sub {
        my ($args) = @_; 
        my ( $dbh, $out ) = @$args{qw(dbh out)};

        try {
            $dbh->do(q{SELECT COUNT(*) FROM biblio;});
            say_success( $out, "Retrieved number of biblios");
        } catch {
            say_failure( $out, "Cannot get count of biblios" );
            $_->rethrow;
        };  

        try {
            $dbh->do(q{ALTER TABLE biblio ADD COLUMN biblionumber INT(11);});
            say_success( $out, "Added biblio.biblionumber");
        } catch {
            say_failure( $out, "Cannot add column biblio.biblionumber" );
            $_->rethrow;
        };

        say_success( $out, "Never reached");

    },  
};

This will work:
$ updatedatabase 
DEV atomic update
/kohadevbox/koha/installer/data/mysql/atomicupdate/bug_12345.pl  [09:18:16]:
Bug 12345 - Do stuffs with biblios
        Retrieved number of biblios
        Cannot add column biblio.biblionumber
ERROR - C4::Installer::try {...} (): DBI Exception: DBD::mysql::db do failed:
Duplicate column name 'biblionumber' at
/kohadevbox/koha/installer/data/mysql/atomicupdate/bug_12345.pl line 26

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to