ColumnDefinition

Classes > Migration > ColumnDefinition

Column definition with type and all database-agnostic constraints.

public sealed record ColumnDefinition : IEquatable<ColumnDefinition>

Properties

Name

public string Name { get; init; }

Column name (case-insensitive for comparison).

Type

public required PortableType Type { get; init; }

Portable type with full precision/scale/length info.

IsNullable

public bool IsNullable { get; init; }

Whether NULL values are allowed.

DefaultValue

public string? DefaultValue { get; init; }

SQL default expression (platform-specific, e.g., "CURRENT_TIMESTAMP").

DefaultLqlExpression

public string? DefaultLqlExpression { get; init; }

LQL default expression (platform-independent, e.g., "now()", "gen_uuid()"). When set, DDL generators translate this to platform-specific SQL. Takes precedence over DefaultValue if both are set.

IsIdentity

public bool IsIdentity { get; init; }

Auto-increment/identity column.

IdentitySeed

public long IdentitySeed { get; init; }

Identity seed value (starting number).

IdentityIncrement

public long IdentityIncrement { get; init; }

Identity increment value.

ComputedExpression

public string? ComputedExpression { get; init; }

Computed column expression (if computed).

IsComputedPersisted

public bool IsComputedPersisted { get; init; }

Whether computed column is persisted/stored.

Collation

public string? Collation { get; init; }

Collation for string columns (e.g., "NOCASE", "en_US.UTF-8").

CheckConstraint

public string? CheckConstraint { get; init; }

Check constraint expression for this column only.

Comment

public string? Comment { get; init; }

Column comment/description for documentation.