Skip to content

Commit

Permalink
Report the types of the fields that differ.
Browse files Browse the repository at this point in the history
For example, the checkbox label will now say "Change type of field from
INT to BIGINT when upgrading" if the type of the field in the database
is INT and the type in the schema is BIGINT.
  • Loading branch information
drgrice1 committed Jan 16, 2025
1 parent 0b1d0d8 commit 53f8208
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/WeBWorK/ContentGenerator/CourseAdmin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2808,7 +2808,11 @@ sub formatReportOnDatabaseTables ($c, $dbStatus, $courseID = undef) {
"$courseID.$table.fix_type_fieldIDs" => $key,
class => 'form-check-input'
),
$c->maketext('Change type of field when upgrading')
$c->maketext(
'Change type of field from [_1] to [_2] when upgrading',
$fieldInfo{$key}[1],
$fieldInfo{$key}[2]
)
)->join('')
)
)
Expand Down
6 changes: 3 additions & 3 deletions lib/WeBWorK/Utils/CourseDBIntegrityCheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ sub checkTableFields {
} else {
my $data_type = $database_fields{$field_name}[1];
$data_type =~ s/\(\d*\)$// if $data_type =~ /^(big|small)?int\(\d*\)$/;
$data_type = lc($data_type);
my $schema_data_type = lc($db->{$table}{record}->FIELD_DATA->{$field_name}{type} =~ s/ .*$//r);
$data_type = uc($data_type);
my $schema_data_type = uc($db->{$table}{record}->FIELD_DATA->{$field_name}{type} =~ s/ .*$//r);
if ($data_type ne $schema_data_type) {
$fieldStatus{$field_name} = [DIFFER_IN_A_AND_B];
$fieldStatus{$field_name} = [ DIFFER_IN_A_AND_B, $data_type, $schema_data_type ];
$fields_ok = 0;
}
}
Expand Down

0 comments on commit 53f8208

Please sign in to comment.