migrating entire set of attributes and attribute sets to a fresh installation
-
16-10-2019 - |
Question
I have a rather large set of attributes and a dozen attribute sets that I need to migrate to a fresh installation of Magento of the same version down the road. I'd like to do this without carrying over the attribute values theselves.
Has anyone done this safely? I have exported-imported the eav_*
and catalog_eav_attribute
in the past to move all attribute-related data while testing some things, and it seemed to have work without problems that I could notice. But what if I want to just perfectly copy over attributes, attribute sets, and no attribute values that are new to the fresh installation (i.e. no products)?
Solution
I also had to deal with this kind of issue once.
Possible ways of migrating the attributes and attribute-sets to a fresh (!!) installation:
Copying tables to the new database
As the OP already already mentioned, copying the eav_*
and catalog_eav_attribute
is a possible option.
Creating setup scripts to execute on the new installation
This is the best-practise way in this case. The OP mentioned Magento shell scripts above, but I guess Magento setup/data scripts where meant. Create a new module, add a setup or a data resource and add your script(s) which contain the code to generate your attributes and attribute sets.
You can have a look at the eav_setup
and catalog_setup
how Magento sets up the default attributes & attribute sets.
Use SOAP
If you don't have/cannot get access to the second magento installation, you could think about writing a SOAP-script to retrieve the attributes and attribute-sets. This is not the fastest option of all, but still a possibility. Be aware that the functions of the SOAP API is limited.
Personal note: I think I can remember that I have encountered some issues with the attribute groups, so you might need to extend the SOAP functions at least a bit.