Magento Custom Module EAV Attribute Table Unique Key

I created a Magento 1.9.2 module with EAV Table for importing custom data, but when I tried to import second time and update the existing data, it created new entries in Attribute table instead of updating it. I searched for awhile finally figure out that the Setup script won’t create unique key (entity_id, entity_type_id, store_id, attribute_id) for my attributes table.

Although I can just use command to add the unique key, I want to do it inside the setup script. End up it is straight forward.

 

Read More