module

Marten::DB::Model::Table::ClassMethods

Instance methods

db_index(name : String | Symbol, field_names : Array(String) | Array(Symbol)) : Nil

Allows to explicitly configure a new index for a specific set of fields.

This method allows to configure a new index targetting a specific set of fields. Indexes must be associated with a mandatory name that must be unique accross all the indexes of the considered model.

Source
db_indexes

Returns the configured database indexes.

Source
db_table(db_table : String | Symbol)

Allows to explicitely define the name of the table associated with the model.

Source
db_table

Returns the name of the table associated with the considered model.

Unless explicitely specified, the table name is automatically generated based on the label of the app associated with the considered model and the class name of the model.

Source
db_unique_constraint(name : String | Symbol, field_names : Array(String) | Array(Symbol)) : Nil

Allows to explicitly configure a new unique constraint for a specific set of fields.

This method allows to configure a new unique constraint targetting a specific set of fields. Unique constraints must be associated with a mandatory name that must be unique accross all the constraints of the considered model.

Source
db_unique_constraints

Returns the configured unique database constraints.

Source
fields

Returns all the fields instances associated with the current model.

It is worth mentioning that this method will return all the fields of the considered model: the local model fields and model fields from parent classes.

Source
get_field(id : String | Symbol) : Field::Base

Allows to retrieve a specific field instance associated with the current model.

The returned object will be an instance of a subclass of Marten::DB::Field::Base. It is worth mentioning that this method will return local model fields as well as parent model fields.

Source
get_local_field(id : String | Symbol) : Field::Base

Allows to retrieve a specific field instance associated with the current model.

The returned object will be an instance of a subclass of Marten::DB::Field::Base. It is worth mentioning that this method will return local model fields only.

Source
local_fields

Returns all the local fields instances associated with the current model.

Source
parent_models

Returns the parent models.

Source