Fix #20329: pgsql: Column Schema doesn't recognize PG type cast

This commit is contained in:
Vladimir
2025-02-28 00:33:35 +10:00
committed by GitHub
parent dbb82a25a2
commit e38f62e55b
3 changed files with 68 additions and 4 deletions

View File

@ -552,10 +552,13 @@ SQL;
} elseif ($column->defaultValue) {
if (
in_array($column->type, [self::TYPE_TIMESTAMP, self::TYPE_DATE, self::TYPE_TIME], true) &&
in_array(
strtoupper($column->defaultValue),
['NOW()', 'CURRENT_TIMESTAMP', 'CURRENT_DATE', 'CURRENT_TIME'],
true
(
in_array(
strtoupper($column->defaultValue),
['NOW()', 'CURRENT_TIMESTAMP', 'CURRENT_DATE', 'CURRENT_TIME'],
true
) ||
(false !== strpos($column->defaultValue, '('))
)
) {
$column->defaultValue = new Expression($column->defaultValue);