Skip to content

Commit c698426

Browse files
committed
Use another approach to avoid catching date types
1 parent 1e086e2 commit c698426

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
@@ -3767,8 +3767,13 @@ function ( $column ) use ( $table_name, $key_length_limit ) {
37673767
$data_length = min( $matches[2], $key_length_limit ); // "255"
37683768
}
37693769

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

0 commit comments

Comments
 (0)