Koha/installer/data/mysql/db_revs/221200041.pl
Tomas Cohen Arazi d86786401a
Bug 30649: DBRev 22.12.00.041
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-15 18:23:51 -03:00

25 lines
811 B
Perl
Executable file

use Modern::Perl;
return {
bug_number => "30649",
description => "Increase the vendor EDI account password field to 256 characters",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
$dbh->do(q{
ALTER TABLE vendor_edi_accounts CHANGE COLUMN `password` `password` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL
});
require Koha::Encryption;
my $e = Koha::Encryption->new;
my $schema = Koha::Database->new()->schema();
my $rs = $schema->resultset('VendorEdiAccount')->search();
while ( my $a = $rs->next() ) {
my $password = $a->password;
$password = $e->encrypt_hex($password);
$a->password($password);
$a->update();
}
},
};