With this change, a Magma::Attribute's attribute_name can be changed at any time without also requiring a migration to the Magma::Attribute's project table. This is accomplished by adding a column_name column to the attributes table.
To help verify this new behavior, I changed a few attribute_names to make them different from their column_names. A few things came out as a result:
Change Magma::Model.identity so it holds the identifier attribute instead of a symbol. Now that attribute_name and column_name can be different, a symbol with one of those values is no longer sufficient.
Magma::Model.identity will fallback to a default primary key identifier for models who don't specify identifiers. This will make Magma::Model.identity's behavior consistent across the board.
Pass full attribute object to Magma::ColumnPredicates so the predicates can get column_name and attribute_name as needed.
Define alias methods on Magma::Models for attributes that have different attribute_name/column_name because Sequel will only define methods based on column_name.
With this change, a
Magma::Attribute
'sattribute_name
can be changed at any time without also requiring a migration to theMagma::Attribute
's project table. This is accomplished by adding acolumn_name
column to theattributes
table.To help verify this new behavior, I changed a few
attribute_name
s to make them different from theircolumn_name
s. A few things came out as a result:Magma::Model.identity
so it holds the identifier attribute instead of a symbol. Now thatattribute_name
andcolumn_name
can be different, a symbol with one of those values is no longer sufficient.Magma::Model.identity
will fallback to a default primary key identifier for models who don't specify identifiers. This will makeMagma::Model.identity
's behavior consistent across the board.Magma::ColumnPredicate
s so the predicates can getcolumn_name
andattribute_name
as needed.Magma::Model
s for attributes that have differentattribute_name
/column_name
because Sequel will only define methods based oncolumn_name
.