struct

Prostore::Schema::Field

Inherits Struct < Value < Object

A column declaration captured from a field macro call (ADR-0002, 0004, 0011, 0013, 0014).

The actual default/backfill/lazy lambdas (when present) are not stored here — they are captured separately at the macro level and referenced by generated code. This struct holds only schema-level facts that survive into the fingerprint, the diff engine, and the migration plan. Note on String typing: while the user-facing DSL accepts Symbols (field 1, :id, ...), the macro stores the column name as a String at the schema-model level. This lets prostore round-trip schema state through JSON for ADR-0009's persisted migration plan. The Crystal type system can't construct Symbols at runtime, so a String here is what makes resume work.

Constructors

new(tag : Int32, name : String, crystal_type : String, portable_type : String, nullable : Bool, primary : Bool, auto_increment : Bool, has_default : Bool, default_sql : String | Nil, has_backfill : Bool, backfill_sql : String | Nil, has_lazy : Bool, enum_members : Array(EnumMember) | Nil = nil, enum_is_flags : Bool = false)
Source

Instance methods

auto_increment
backfill_sql
clone
Source
copy_with(tag _tag = @tag, name _name = @name, crystal_type _crystal_type = @crystal_type, portable_type _portable_type = @portable_type, nullable _nullable = @nullable, primary _primary = @primary, auto_increment _auto_increment = @auto_increment, has_default _has_default = @has_default, default_sql _default_sql = @default_sql, has_backfill _has_backfill = @has_backfill, backfill_sql _backfill_sql = @backfill_sql, has_lazy _has_lazy = @has_lazy, enum_members _enum_members = @enum_members, enum_is_flags _enum_is_flags = @enum_is_flags)
Source
crystal_type
default_sql
enum_check_constraint_name(table : String) : String

Stable CHECK-constraint name for an enum field (ADR-0016). Used by both the CREATE TABLE renderer and the AlterEnumMembers step so the constraint can be located and replaced at migration time.

Source
enum_is_flags
enum_members
has_backfill
has_default
has_lambda_backfill?
Source
has_lambda_default?
Source
has_lazy
name
nullable
portable_type
primary
tag