The question is raised because in my catalog_category, I have a user attribute originally 255 length varchar. Now I am told by users it was not long enough for block text. I want to change it to text type in mysql to solve the problem.
I know EAV attributes use different tables for different type. My worry is moving attribute value from varchar table to text table when changing the EAV attribute backend type. Anyway, I have to try before I know. Here is my steps:
- go to table magento_eav_attribute, find the attribute, change backend_type from varchar to text
- (what’s next?) I am about to change something else, but surprisingly, nothing else! All done after step 1.
I do not need to move old values from magento_catalog_category_entity_varchar to magento_catalog_category_entity_text. After change attribute’s backend_type, Magento can still read existing value from magento_catalog_category_entity_varchar, but if I save the category, the value will save to magento_catalog_category_entity_text. Old value is not deleted from magento_catalog_category_entity_varchar, but it does no harm.
I am curious at how Magento did it – Does Magento go through 5 tables (datetime, decimal, int, text, varchar) to get a value? Or Magento cache attributes’ backend type (so even I make changes in magento_eav_attribute, Magento still have records of old type)?
Leave a Reply