Skip to content

Commit 3704af6

Browse files
committed
Use another approach to avoid catching date types
1 parent cd1fcba commit 3704af6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

wp-includes/sqlite/class-wp-sqlite-translator.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3766,8 +3766,13 @@ function ( $column ) use ( $table_name, $key_length_limit ) {
37663766
$data_length = min( $matches[2], $key_length_limit ); // "255"
37673767
}
37683768

3769-
// Set the data length to the varchar and text key length
3770-
if ( in_array( $this->field_types_translation[ $data_type ], array( 'text', 'blob' ), true ) ) {
3769+
// Set the data length to the varchar and text key lengths
3770+
// char, varchar, varbinary, tinyblob, tinytext, blob, text, mediumblob, mediumtext, longblob, longtext
3771+
if ( str_ends_with( $data_type, 'char' ) ||
3772+
str_ends_with( $data_type, 'text' ) ||
3773+
str_ends_with( $data_type, 'blob' ) ||
3774+
str_starts_with( $data_type, 'var' )
3775+
) {
37713776
return sprintf( '`%s`(%s)', $column['name'], $data_length );
37723777
}
37733778
return sprintf( '`%s`', $column['name'] );

0 commit comments

Comments
 (0)