Bug 38489: (follow-up) Make old db_rev more idempotent 2

In the unit test system we reset the database version to 21.11 after
having upgraded a long way past that. The 231200022 update appears not
to be fully idempotent, so we fail running through the upgrade.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2025-10-15 16:41:38 +01:00 committed by Lucas Gass
parent bf3b1e07a6
commit eb5c38a5ab
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 17 additions and 15 deletions

View File

@ -7,24 +7,26 @@ return {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
if ( !column_exists( 'vendor_edi_accounts', 'download_port' ) ) {
$dbh->do(
q{
ALTER TABLE vendor_edi_accounts ADD COLUMN `download_port` int(11) DEFAULT NULL AFTER `password`
}
);
if ( column_exists( 'vendor_edi_accounts', 'password' ) ) {
if ( !column_exists( 'vendor_edi_accounts', 'download_port' ) ) {
$dbh->do(
q{
ALTER TABLE vendor_edi_accounts ADD COLUMN `download_port` int(11) DEFAULT NULL AFTER `password`
}
);
say $out "Added column 'vendor_edi_accounts.download_port'";
}
say $out "Added column 'vendor_edi_accounts.download_port'";
}
if ( !column_exists( 'vendor_edi_accounts', 'upload_port' ) ) {
$dbh->do(
q{
ALTER TABLE vendor_edi_accounts ADD COLUMN `upload_port` int(11) DEFAULT NULL AFTER `download_port`
}
);
if ( !column_exists( 'vendor_edi_accounts', 'upload_port' ) ) {
$dbh->do(
q{
ALTER TABLE vendor_edi_accounts ADD COLUMN `upload_port` int(11) DEFAULT NULL AFTER `download_port`
}
);
say $out "Added column 'vendor_edi_accounts.upload_port'";
say $out "Added column 'vendor_edi_accounts.upload_port'";
}
}
},
};