currently, I am developing a Magento extension, that needs to add several custom attributes to the customer address. I've found several tutorials on the topic that describe precisely what I need to build http://www.unexpectedit.com/magento/add-new-customer-attribute-onepage-magento-checkout http://www.excellencemagentoblog.com/magento-adding-custom-field-to-customer-address

They all use ALTER TABLE to add columns to several DB tables. My question is :

Is it upgrade safely to do this?

Thanks in advance


Yes this is upgrade proof, the whole idea of the EAV model is that you can safely add attributes without having problem with upgrades etc. For the customer section there only isn't an interface to add customer attributes like there is for products (there is on the EE edition). Because of this you need to run the scripts as described in those blogposts.

| improve this answer | |
  • 1
    @EvgeniIvanov - Paul is correct here, but I would like to point out (since he did not) that when you add an attribute to an EAV model, ALTER TABLE queries are not used since columns are not being added. Since customer and customer address models are EAV, it's merely adding the needed records to the eav_* tables to define the attribute. – davidalger May 16 '13 at 13:27
  • I just need one last clarification: i need to alter the "sales_flat_order_address" and "sales_flat_quote_address" table.Since those two table are "flat" is this OK. – Evgeni Ivanov May 20 '13 at 8:09
  • Yes, this is no problem. – Paul Hachmang Jun 3 '13 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.