struct
Prostore::Schema::Field
- Prostore::Schema::Field
- Struct
- Value
- Object
Overview
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.
Defined in:
prostore/schema/field.crConstructors
Instance Method Summary
- #auto_increment : Bool
- #backfill_sql : String | Nil
- #clone
- #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)
- #crystal_type : String
- #default_sql : String | Nil
-
#enum_check_constraint_name(table : String) : String
Stable CHECK-constraint name for an enum field (ADR-0016).
- #enum_is_flags : Bool
- #enum_members : Array(EnumMember) | Nil
- #has_backfill : Bool
- #has_default : Bool
- #has_lambda_backfill? : Bool
- #has_lambda_default? : Bool
- #has_lazy : Bool
- #name : String
- #nullable : Bool
- #portable_type : String
- #primary : Bool
- #tag : Int32
Constructor Detail
Instance Method Detail
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.