Repository navigation
Internals Database Creator Column ColumnDefinition
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/database/creator/column/ColumnDefinition.php · Snapshot 8411f4287706.
DatabaseManager delegates SQL generation to QueryBuilder, execution to IProvider, and result caching to ICache. Schema builders use MySQL DDL and the framework table registry.
final class ColumnDefinitionSource description (behavioral corrections are recorded in Known discrepancies):
ColumnDefinition
Immutable value object that describes a single database column and its constraints. Constructed exclusively by ColumnCreator and consumed by ColumnSQLBuilder. No class other than those two should create instances directly.
Every property is read-only after construction, making it safe to pass between collaborators without defensive copying.
Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.
| Member | Declaration | Purpose or source contract |
|---|---|---|
| Constructor-promoted | public readonly string $name |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly string $type |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly string $length = '' |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly bool $nullable = false |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly string $default = '' |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly bool $defaultAsDefined = false |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly bool $autoIncrement = false |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly bool $unsigned = false |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly string $index = '' |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly string $comment = '' |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly string $after = '' |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly array $enumValues = [] |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly ?string $foreignKeyTable = null |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly ?string $foreignKeyColumn = null |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly ?string $onDelete = null |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public readonly ?string $onUpdate = null |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Method | Signature |
|---|---|
| __construct | public function __construct( public readonly string $name, public readonly string $type, public readonly string $length = '', public readonly bool $nullable = false, public readonly string $default = '', public readonly bool $defaultAsDefined = false, public readonly bool $autoIncrement = false, public readonly bool $unsigned = false, public readonly string $index = '', public readonly string $comment = '', public readonly string $after = '', public readonly array $enumValues = [], public readonly ?string $foreignKeyTable = null, public readonly ?string $foreignKeyColumn = null, public readonly ?string $onDelete = null, public readonly ?string $onUpdate = null, ) |
public function __construct(
public readonly string $name,
public readonly string $type,
public readonly string $length = '',
public readonly bool $nullable = false,
public readonly string $default = '',
public readonly bool $defaultAsDefined = false,
public readonly bool $autoIncrement = false,
public readonly bool $unsigned = false,
public readonly string $index = '',
public readonly string $comment = '',
public readonly string $after = '',
public readonly array $enumValues = [],
public readonly ?string $foreignKeyTable = null,
public readonly ?string $foreignKeyColumn = null,
public readonly ?string $onDelete = null,
public readonly ?string $onUpdate = null,
);| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$name |
public readonly string $name |
Column name. |
$type |
public readonly string $type |
SQL type keyword: INT, VARCHAR, TEXT, etc. |
$length |
public readonly string $length = '' |
Length/precision qualifier, e.g. "11" or "10,2". |
$nullable |
public readonly bool $nullable = false |
When true, the column accepts NULL values. |
$default |
public readonly string $default = '' |
Default value expression. Empty means no DEFAULT clause. |
$defaultAsDefined |
public readonly bool $defaultAsDefined = false |
When true, $default is emitted verbatim without quoting |
$autoIncrement |
public readonly bool $autoIncrement = false |
Adds AUTO_INCREMENT to the column definition. |
$unsigned |
public readonly bool $unsigned = false |
Adds UNSIGNED to numeric column definitions. |
$index |
public readonly string $index = '' |
Index type to inline: PRIMARY, UNIQUE, INDEX, or empty. |
$comment |
public readonly string $comment = '' |
Optional column comment stored in the schema. |
$after |
public readonly string $after = '' |
When non-empty, appends AFTER column to ALTER TABLE |
$enumValues |
public readonly array $enumValues = [] |
Ordered list of allowed values for ENUM and SET columns. |
$foreignKeyTable |
public readonly ?string $foreignKeyTable = null |
Target table for a FOREIGN KEY constraint, or null. |
$foreignKeyColumn |
public readonly ?string $foreignKeyColumn = null |
Target column for a FOREIGN KEY constraint, or null. |
$onDelete |
public readonly ?string $onDelete = null |
ON DELETE action: CASCADE, SET NULL, RESTRICT, etc. |
$onUpdate |
public readonly ?string $onUpdate = null |
ON UPDATE action: CASCADE, SET NULL, RESTRICT, etc. |
@param string $name Column name.
@param string $type SQL type keyword: INT, VARCHAR, TEXT, etc.
@param string $length Length/precision qualifier, e.g. "11" or "10,2".
Empty when the type does not accept a length.
@param bool $nullable When true, the column accepts NULL values.
@param string $default Default value expression. Empty means no DEFAULT clause.
@param bool $defaultAsDefined When true, $default is emitted verbatim without quoting
(e.g. for expressions like CURRENT_TIMESTAMP or NOW()).
@param bool $autoIncrement Adds AUTO_INCREMENT to the column definition.
@param bool $unsigned Adds UNSIGNED to numeric column definitions.
@param string $index Index type to inline: PRIMARY, UNIQUE, INDEX, or empty.
@param string $comment Optional column comment stored in the schema.
@param string $after When non-empty, appends AFTER column to ALTER TABLE
ADD COLUMN statements for explicit column positioning.
@param array $enumValues Ordered list of allowed values for ENUM and SET columns.
@param string|null $foreignKeyTable Target table for a FOREIGN KEY constraint, or null.
@param string|null $foreignKeyColumn Target column for a FOREIGN KEY constraint, or null.
@param string|null $onDelete ON DELETE action: CASCADE, SET NULL, RESTRICT, etc.
@param string|null $onUpdate ON UPDATE action: CASCADE, SET NULL, RESTRICT, etc.
Concrete no-op/default hook: this method performs no work. Override it where the lifecycle or extension contract calls for behavior.
AWT Framework Wiki · Home · Installation Guide · Developer Guide · Framework Internals
Philosophy · Architecture · Known discrepancies · Verification
Installation Guide
Developer Guide
- Learning sequence
- First package
- Package structure
- Lifecycle
- Runtimes
- Events and objects
- Routing and controllers
- Views and resources
- Database and models
- Storage and caching
- Configuration and CLI
- Responses and errors
- Extension points
Framework Internals
- Architecture
- Bootstrap
- Packages
- Runtime
- Events and context
- Objects
- HTTP routing and controllers
- Rendering
- Blade integration
- Database
- Models
- Storage and caching
- Settings
- CLI
- Identity and sessions
- Responses
- Errors
- Complete source inventory
Documentation notes