[Koha-bugs] [Bug 28267] Koha-common package upgrade problem from 20.05.xx to 20.11.04-1

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jun 28 05:45:35 CEST 2021


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

--- Comment #14 from skaman.tx at gmail.com ---
So I am not a developer and I do not know how to patch the koha files using
git.  Thus, as Kartin suggested I would have to do, I manually edited the diff
file Jonathan posted and I created the
installer/data/mysql/atomicupdate/bug_28267.perl file with the following
contents:

$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
    my $fields = {
        itemcallnumber           => 255,
        coded_location_qualifier => 10,
        location                 => 80,
        permanent_location       => 80,
        cn_source                => 10,
        cn_sort                  => 255,
        ccode                    => 80,
        itype                    => 10,
        copynumber               => 32,
        stocknumber              => 32,
        new_status               => 32,
    };
    # Index on items
    for my $index ( qw( itemstocknumberidx itemcallnumber items_location
items_ccode itype_idx ) ) {
        next unless index_exists('items', $index);
        $dbh->do(qq|
            ALTER TABLE items DROP INDEX $index
        |);
    }

    # Index on deleteditems
    for my $index ( qw( delitemstocknumberidx itype_idx ) ) {
        next unless index_exists('deleteditems', $index);
        $dbh->do(qq|
            ALTER TABLE deleteditems DROP INDEX $index
        |);
    }

    while ( my ( $f, $size ) = each %$fields ) {
        my $datatype = ( $size >= 24 ) ? 'TEXT' : 'TINYTEXT';
        my $size_index = ( $size == 255 ) ? 191 : $size;

        $dbh->do(qq|
            ALTER TABLE items MODIFY $f $datatype DEFAULT NULL
        |);

        # Re-add index on items
        unless ( index_exists( 'items', sprintf("%s_idx", $f) ) ) {
            $dbh->do(sprintf q|
                ALTER TABLE items ADD INDEX %s_idx( %s(%s) )
            |, $f, $f, $size_index);
            }

        $dbh->do(qq|
            ALTER TABLE deleteditems MODIFY $f $datatype DEFAULT NULL
        |);
    }

    # Re-add index on deleteditems
    unless ( index_exists( 'deleteditems', 'itype_idx' ) ) {
        $dbh->do(q|
            ALTER TABLE deleteditems ADD INDEX itype_idx( itype(10))
        |);
    }
    unless ( index_exists( 'deleteditems', 'stocknumber_idx' ) ) {
        $dbh->do(q|
            ALTER TABLE deleteditems ADD INDEX stocknumber_idx( itype(32))
        |);
    }

    NewVersion( $DBversion, 28267, "Switch items VARCHAR fields to TINYTEXT or
MEDIUMTEXT");
}


I then manually edited the kohastructure.sql file adding the "+" lines from the
diff file and removing the "-" lines.  I made sure all the added lines
instances of "default NULL" were "default NULL," as well.

I set the following variables via the debian command line:

  export PERL5LIB=/usr/share/koha/lib
  export KOHA_CONF=/etc/koha/sites/library/koha-conf.xml

And then I ran:

  perl /usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl

Alas, I get the following error.

{UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Row size too large. The
maximum row size for the used table type, not counting BLOBs, is 8126. This
includes storage overhead, check the manual. You have to change some columns to
TEXT or BLOBs [for Statement "
            ALTER TABLE `items` ADD COLUMN `exclude_from_local_holds_priority`
tinyint(1) default NULL AFTER `new_status`
        "]  at /usr/share/perl5/DBIx/Class/Schema.pm line 1118.
        DBIx::Class::Schema::throw_exception(Koha::Schema=HASH(0x5616a4e90248),
"DBI Exception: DBD::mysql::db do failed: Row size too large. "...) called at
/usr/share/perl5/DBIx/Class/Storage.pm line 113
       
DBIx::Class::Storage::throw_exception(DBIx::Class::Storage::DBI::mysql=HASH(0x5616a3f14ff8),
"DBI Exception: DBD::mysql::db do failed: Row size too large. "...) called at
/usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1501
        DBIx::Class::Storage::DBI::__ANON__("DBD::mysql::db do failed: Row size
too large. The maximum row"..., DBI::db=HASH(0x5616a5993ba8), undef) called at
/usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl line
22720


Any further thoughts?

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list