diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bc0e4ab0..40cc7b3a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,12 +3,6 @@ **Implemented enhancements:** -- Add ISO for Debian Buster [\#1108] -- non-predictable MAC addresses [\#1103] -- first login fails after inactivity logout [\#1102] - **Bugfixes** -- Specified key was too long with MariaDB 10.1 in Debian [\#1104] -- Login name with spaces [\#1100] -- Volatile domains get invalid SPICE IP [\#1099] +- Data too long for column display [\#1107] diff --git a/lib/Ravada.pm b/lib/Ravada.pm index 2439c8e8c..bc426db39 100644 --- a/lib/Ravada.pm +++ b/lib/Ravada.pm @@ -1092,16 +1092,27 @@ sub _upgrade_table { my $dbh = $CONNECTOR->dbh; my ($new_size) = $definition =~ m{\((\d+)}; + my ($new_type) = $definition =~ m{(\w+)}; my $sth = $dbh->column_info(undef,undef,$table,$field); my $row = $sth->fetchrow_hashref; $sth->finish; if ( $dbh->{Driver}{Name} =~ /mysql/ - && $row && $row->{COLUMN_SIZE} - && $new_size - && $new_size != $row->{COLUMN_SIZE}) { + && $row + && ( + ($row->{COLUMN_SIZE} + && defined $new_size + && $new_size != $row->{COLUMN_SIZE} + ) || ( + lc($row->{TYPE_NAME}) ne lc($new_type) + ) + ) + ){ - warn "INFO: changing $field $row->{COLUMN_SIZE} to $new_size in $table\n$definition\n" if $0 !~ /\.t$/; + warn "INFO: changing $field\n" + ." $row->{COLUMN_SIZE} to ".($new_size or '')."\n" + ." $row->{TYPE_NAME} -> $new_type \n" + ." in $table\n$definition\n" if $0 !~ /\.t$/; $dbh->do("alter table $table change $field $field $definition"); return; } @@ -1206,7 +1217,7 @@ sub _upgrade_tables { $self->_upgrade_table('vms','vm_type',"char(20) NOT NULL DEFAULT 'KVM'"); $self->_upgrade_table('vms','connection_args',"text DEFAULT NULL"); - $self->_upgrade_table('vms','cached_active_time',"integer DEFAULT 0"); + $self->_upgrade_table('vms','cached_active_time',"int DEFAULT 0"); $self->_upgrade_table('vms','public_ip',"varchar(128) DEFAULT NULL"); $self->_upgrade_table('vms','is_active',"int DEFAULT 0"); $self->_upgrade_table('vms','enabled',"int DEFAULT 1");