struct

Ralph::Schema::ModelSchema

Inherits Struct / Value / Object

Complete model schema derived from Ralph::Model

Constructors

new(table_name : String, columns : Array(ModelColumn) = [] of ModelColumn, foreign_keys : Array(ModelForeignKey) = [] of ModelForeignKey, indexes : Array(DatabaseIndex) = [] of DatabaseIndex, polymorphic_fk_columns : Set(String) = Set(String).new)
Source

Instance methods

column(name : String) : ModelColumn | Nil

Get a column by name

Source
columns
Source
columns=(columns : Array(ModelColumn))
Source
foreign_keys
Source
foreign_keys=(foreign_keys : Array(ModelForeignKey))
Source
has_column?(name : String) : Bool

Check if model has a column

Source
indexes
Source
indexes=(indexes : Array(DatabaseIndex))
Source
polymorphic_fk?(name : String) : Bool

Check if column is a polymorphic FK column

Source
polymorphic_fk_columns

Columns that are polymorphic FK columns (stored as String in model but may be UUID/Int in DB)

Source
polymorphic_fk_columns=(polymorphic_fk_columns : Set(String))

Columns that are polymorphic FK columns (stored as String in model but may be UUID/Int in DB)

Source
table_name
Source
table_name=(table_name : String)
Source