File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1149,7 +1149,28 @@ private function parse_mysql_create_table_field() {
11491149 WP_SQLite_Token::FLAG_KEYWORD_FUNCTION ,
11501150 array ( 'DEFAULT ' )
11511151 ) ) {
1152- $ result ->default = $ this ->rewriter ->consume ()->token ;
1152+ // Consume the next token (could be a value, opening paren, etc.)
1153+ $ default_token = $ this ->rewriter ->consume ();
1154+ $ result ->default = $ default_token ->token ;
1155+
1156+ // Check if the default value is wrapped in parentheses (for function calls like (now()))
1157+ if ( $ default_token ->matches ( WP_SQLite_Token::TYPE_OPERATOR , null , array ( '( ' ) ) ) {
1158+ // Track parenthesis depth to consume the complete expression
1159+ $ paren_depth = 1 ;
1160+ $ default_value = '( ' ;
1161+
1162+ while ( $ paren_depth > 0 && ( $ next_token = $ this ->rewriter ->consume () ) ) {
1163+ $ default_value .= $ next_token ->token ;
1164+
1165+ if ( $ next_token ->matches ( WP_SQLite_Token::TYPE_OPERATOR , null , array ( '( ' ) ) ) {
1166+ ++$ paren_depth ;
1167+ } elseif ( $ next_token ->matches ( WP_SQLite_Token::TYPE_OPERATOR , null , array ( ') ' ) ) ) {
1168+ --$ paren_depth ;
1169+ }
1170+ }
1171+
1172+ $ result ->default = $ default_value ;
1173+ }
11531174 continue ;
11541175 }
11551176
You can’t perform that action at this time.
0 commit comments