module Marten::DB::Model::Table::ClassMethods
Defined in:
marten/db/model/table.crInstance Method Summary
-
#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.
-
#db_indexes
Returns the configured database indexes.
-
#db_table(db_table : String | Symbol)
Allows to explicitely define the name of the table associated with the model.
-
#db_table
Returns the name of the table associated with the considered model.
-
#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.
-
#db_unique_constraints
Returns the configured unique database constraints.
-
#fields
Returns all the fields instances associated with the current model.
-
#get_field(id : String | Symbol)
Allows to retrieve a specific field instance associated with the current model.
Instance Method Detail
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.
Allows to explicitely define the name of the table associated with the model.
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.
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.
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
.