Open graft opened 4 years ago
Of note: some dictionaries might refer to the attribute by attribute_name. If these are not renamed in this operation, they will fall out of sync and break. However, it might not be easy to find all of the dictionary names and update them.
If we want to change the name of an existing attribute, we need to rename the column. In the future we might decouple these things; the data table column name could be added to the
attributes
table, so that the reference to the column is independent of the name of the attribute. However, currently the attribute associates with the column strictly by name.To support
rename_attribute
we need only:Since we're fortunately not changing the type of the column or even removing the column from the model, the data itself remains intact throughout and is still associated in the same place. Therefore this action is not actually destructive and we don't need to do anything else.
Here we should only have to validate (after correctly finding the attribute) that
new_attribute_name
is in snake_case and doesn't collide with an existing attribute.