NOTE: How you store/supply each connection's URL is up to you; Granite only cares that it gets registered via
Granite::Connections << adapter_object.
updated_atfield for you.
columnmacro with the
primary: trueoption to denote the primary key.
NOTE: Composite primary keys are not yet supported.
belongs_toassociations can also be used as a primary key in much the same way.
id : Int64.
UUID. This will generate a secure UUID when the model is saved.
crystal docswill not include Granite methods, constants, and properties. To include these, use the
granite_docsflag when generating the documentation. E.x.
crystal docs -D granite_docs.
propertykeyword for its columns, annotations are able to be applied easily. These can either be
YAML::Field, or third party annotations.
Tgeneric argument that tells the converter what type should be read from the
DB::ResultSet. For example, if you wanted to use the
JSONconverter and your underlying database column is
BLOB, you would use
Bytes, if it was
TEXT, you would use
Enum(E, T)- Converts an Enum of type
Eto/from a database column of type
T. Supported types for
Json(M, T)- Converters an
Mto/from a database column of type
T.Supported types for
PgNumeric- Converts a
PG::Numericvalue to a
OrderStatusenum typed field. When saved, the enum value would be converted to a string to be stored in the DB. Then, when read, the string would be used to parse a new instance of