Skip to content

Commit

Permalink
Use another approach to avoid catching date types
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekn committed Dec 19, 2024
1 parent cd1fcba commit 3704af6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wp-includes/sqlite/class-wp-sqlite-translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3766,8 +3766,13 @@ function ( $column ) use ( $table_name, $key_length_limit ) {
$data_length = min( $matches[2], $key_length_limit ); // "255"
}

// Set the data length to the varchar and text key length
if ( in_array( $this->field_types_translation[ $data_type ], array( 'text', 'blob' ), true ) ) {
// Set the data length to the varchar and text key lengths
// char, varchar, varbinary, tinyblob, tinytext, blob, text, mediumblob, mediumtext, longblob, longtext
if ( str_ends_with( $data_type, 'char' ) ||
str_ends_with( $data_type, 'text' ) ||
str_ends_with( $data_type, 'blob' ) ||
str_starts_with( $data_type, 'var' )
) {
return sprintf( '`%s`(%s)', $column['name'], $data_length );
}
return sprintf( '`%s`', $column['name'] );
Expand Down

0 comments on commit 3704af6

Please sign in to comment.