classColumnDefinition
final class ColumnDefinition
Public API: explicitly declared with
@visibility public.A column declaration, before a query can change its nullability.
$consume = static fn (\SqlSemantics\Core\Schema\ColumnDefinition $value): string => $value::class;
$consume instanceof \Closure // => trueProperties§
public string $namepublic TypeDescriptor $typepublic Nullability $nullabilitypublic Element $sourcepublic Element|null $defaultExpression = nullpublic ?ColumnGeneration $generation = nullpublic ?Element $collation = nullpublic bool $autoIncrement = falsepublic list<Element> $attributes = []Methods§
public function __construct(
public string $name,
public TypeDescriptor $type,
public Nullability $nullability,
public Element $source,
public Element|null $defaultExpression = null,
public ?ColumnGeneration $generation = null,
public ?Element $collation = null,
public bool $autoIncrement = false,
public list<Element> $attributes = [],
)Parameters
$name | string | Resolved column name |
$type | TypeDescriptor | Declared database type |
$nullability | Nullability | Declaration-level NULL allowance |
$source | Element | Typed column declaration |
$defaultExpression | Element|null | Typed default clause, evaluated on insertion |
$generation | ?ColumnGeneration | |
$collation | ?Element | |
$autoIncrement | bool | |
$attributes | list<Element> | Complete typed column attributes, in declaration order |
Throws
InvalidArgumentException When supplied state violates its invariantsCalls 3
- static-call Invariant::members() line 43
- class-const Element::class() line 43
- static-call Invariant::elements() line 44
public function withNullability(Nullability $nullability): selfRefines a column's NULL fact while preserving all declaration data.
Parameters
$nullability | Nullability |
Returns
selfThrows
InvalidArgumentException When supplied state violates its invariantsCalls 1
- new
selfline 53
Test cases 60§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ColumnDefinitionTestcalls
Other tests reaching this symbol 59
SchemaAnalyzerTestcallsColumnPropertiesTestcallsColumnReaderTestcallsConstraintReaderTestcallsIdentifiersTestcallsSchemaChangesTestcallsSchemaReaderTestcallsStatementListTestcallsTokenGroupsTestcallsTreeTestcallsTypeReaderTestcallsBinderTestcallsBoundRelationTestcallsExpressionBinderTestcallsExpressionRulesTestcallsFromBinderTestcallsIdentitySequenceTestcallsLiteralBinderTestcallsNullFactsTestcallsProjectionBinderTestcallsScopeTestcallsSelectBinderTestcallsSelectModifiersBinderTestcallsSyntaxGuardTestcallsTableResolverTestcallsTypeResolutionTestcallsDialectTestcallsBoundSelectTestcallsColumnBindingTestcallsExpressionKindTestcallsExpressionTestcallsJoinKindTestcallsJoinTestcallsOrderingTestcallsOutputColumnTestcallsTableUseTestcallsPlatformTestcallsNameRulesTestcallsQueryRulesTestcallsSchemaRulesTestcallsSyntaxRulesTestcallsTypeRulesTestcallsColumnGenerationTestcallsConstraintKindTestcallsGenerationKindTestcallsInvariantTestcallsTableConstraintTestcallsTableDefinitionTestcallsSchemaBuilderTestcallsSchemaTestcallsSemanticExceptionTestcallsNullabilityTestcallsTypeDescriptorTestcallsSchemaTestcallsNameRulesTestcallsPlatformTestcallsQueryRulesTestcallsSchemaRulesTestcallsTypeRulesTestcalls
Relations§
Instantiated in 1
Constant reads 1
Type declarations 7
- type SqlSemantics\Platform\MySql\SchemaRules packages/sql-semantics-mysql/src/SchemaRules.php:66
- type SqlSemantics\Platform\PostgreSql\SchemaRules packages/sql-semantics-postgres/src/SchemaRules.php:66
- type SqlSemantics\Platform\Sqlite\SchemaRules packages/sql-semantics-sqlite/src/SchemaRules.php:79
- type SqlSemantics\Core\Ast\SchemaReader::primaryKeys() packages/sql-semantics/src/Core/Ast/SchemaReader.php:125
- type SqlSemantics\Core\Ast\SchemaReader packages/sql-semantics/src/Core/Ast/SchemaReader.php:156
- type SqlSemantics\Core\Model\ColumnBinding packages/sql-semantics/src/Core/Model/ColumnBinding.php:29
- type SqlSemantics\Core\Policy\SchemaRules packages/sql-semantics/src/Core/Policy/SchemaRules.php:44