File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1130,7 +1130,28 @@ private function parse_mysql_create_table_field() {
11301130 WP_SQLite_Token::FLAG_KEYWORD_FUNCTION ,
11311131 array ( 'DEFAULT ' )
11321132 ) ) {
1133- $ result ->default = $ this ->rewriter ->consume ()->token ;
1133+ // Consume the next token (could be a value, opening paren, etc.)
1134+ $ default_token = $ this ->rewriter ->consume ();
1135+ $ result ->default = $ default_token ->token ;
1136+
1137+ // Check if the default value is wrapped in parentheses (for function calls like (now()))
1138+ if ( $ default_token ->matches ( WP_SQLite_Token::TYPE_OPERATOR , null , array ( '( ' ) ) ) {
1139+ // Track parenthesis depth to consume the complete expression
1140+ $ paren_depth = 1 ;
1141+ $ default_value = '( ' ;
1142+
1143+ while ( $ paren_depth > 0 && ( $ next_token = $ this ->rewriter ->consume () ) ) {
1144+ $ default_value .= $ next_token ->token ;
1145+
1146+ if ( $ next_token ->matches ( WP_SQLite_Token::TYPE_OPERATOR , null , array ( '( ' ) ) ) {
1147+ ++$ paren_depth ;
1148+ } elseif ( $ next_token ->matches ( WP_SQLite_Token::TYPE_OPERATOR , null , array ( ') ' ) ) ) {
1149+ --$ paren_depth ;
1150+ }
1151+ }
1152+
1153+ $ result ->default = $ default_value ;
1154+ }
11341155 continue ;
11351156 }
11361157
You can’t perform that action at this time.
0 commit comments