classDefaultExpression
final class DefaultExpression
implements ColumnAttribute
uses Snapshot
Public API: explicitly declared with
@visibility public.A column default written as an expression in parentheses (MySQL 8.0.13 and later).
The expression is evaluated when a row is inserted; it may refer to earlier columns of the table, and the server stores it as an expression default even when it is a literal. Source: https://dev.mysql.com/doc/refman/8.4/en/data-type-defaults.html#data-type-defaults-explicit.
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE TABLE t (a TIMESTAMP DEFAULT (NOW()))');
$create->statement->elements[0]->specification->attributes[0] instanceof \SqlSemantics\Platform\MySql\Statement\Table\Column\DefaultExpression // => trueProperties§
public Scalar $expressionMethods§
public function __construct(public Scalar $expression)Parameters
$expression | Scalar | The default expression |
public function deriveAttribute(Derivation $derivation, Environment $scope): voidDerives the expression inside the table definition.
Parameters
$derivation | Derivation | |
$scope | Environment |
Calls 1
- method-call Derivation::scalar() line 40
public function render(Output $out): voidTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.