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.

Reading the clause of a columndoctest
$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 // => true

Properties§

public Scalar $expression

Methods§

public function __construct(public Scalar $expression)

Parameters

$expressionScalarThe default expression
public function deriveAttribute(Derivation $derivation, Environment $scope): void

Derives the expression inside the table definition.

Parameters

$derivationDerivation
$scopeEnvironment
Calls 1
public function render(Output $out): void

Writes the clause.

Parameters

$outOutput
Calls 1

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Type checks 1