title: Magento - create new customer attribute
body: <p>I need to create 4 new customer attributes in my magento store. I have created a module as below to do so:</p>
  
  <pre><code>Customerattribute &gt;
      etc &gt; config.xml
      Model &gt; Mysql4 &gt; Setup.php
      sql &gt; customerattribute_setup &gt; mysql4-install-0.0.1.php
  </code></pre>
  
  <p>config.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;config&gt;
    &lt;modules&gt;
      &lt;Custom_Customerattribute&gt;
        &lt;version&gt;0.0.1&lt;/version&gt;
      &lt;/Custom_Customerattribute&gt;
    &lt;/modules&gt;
      &lt;global&gt;
          &lt;resources&gt;
              &lt;customerattribute_setup&gt;
                  &lt;setup&gt;
                      &lt;module&gt;Custom_Customerattribute&lt;/module&gt;
                      &lt;class&gt;Custom_Customerattribute_Model_Mysql4_Setup&lt;/class&gt;
                  &lt;/setup&gt;
                  ....
              &lt;/customerattribute_setup&gt;
          &lt;/resources&gt;
      &lt;/global&gt;
  &lt;/config&gt;
  </code></pre>
  
  <p>Setup.php</p>
  
  <pre><code>class Custom_Customerattribute_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup 
  {
      /**
       * This method returns true if the attribute exists.
       * 
       * @param string|int $entityTypeId
       * @param string|int $attributeId
       * @return bool
       */
      public function attributeExists($entityTypeId, $attributeId) 
      {
          try 
          {
              $entityTypeId = $this-&gt;getEntityTypeId($entityTypeId);
              $attributeId = $this-&gt;getAttributeId($entityTypeId, $attributeId);
              return !empty($attributeId);
          } 
          catch(Exception $e) 
          {
              return FALSE;
          }
      }
  }
  </code></pre>
  
  <p>mysql4-install-0.0.1.php</p>
  
  <pre><code>$installer = $this;
  $installer-&gt;startSetup();
  $entity = $installer-&gt;getEntityTypeId('customer');
  
  if(!$installer-&gt;attributeExists($entity, 'paypal')) {
      $installer-&gt;removeAttribute($entity, 'paypal');
  }
  
  $installer-&gt;addAttribute($entity, 'paypal', array(
          'type' =&gt; 'text',
          'label' =&gt; 'Paypal',
          'input' =&gt; 'text',
          'visible' =&gt; TRUE,
          'required' =&gt; FALSE,
          'default_value' =&gt; '',
          'adminhtml_only' =&gt; '0'
  ));
  
  $forms = array(
      'adminhtml_customer',
      'customer_account_edit'
  );
  $attribute = Mage::getSingleton('eav/config')-&gt;getAttribute($installer-&gt;getEntityTypeId('customer'), 'paypal');
  $attribute-&gt;setData('used_in_forms', $forms);
  $attribute-&gt;save();
  
  $installer-&gt;endSetup();
  </code></pre>
  
  <p>This works for my first customer attribute of <code>paypal</code> but i now want to be able to add 3 others. I had hoped that if i change the <code>mysql4-install-0.0.1.php</code> file to say this:</p>
  
  <pre><code>$installer = $this;
  $installer-&gt;startSetup();
  $entity = $installer-&gt;getEntityTypeId('customer');
  
  if(!$installer-&gt;attributeExists($entity, 'attribute_2')) {
      $installer-&gt;removeAttribute($entity, 'attribute_2');
  }
  
  $installer-&gt;addAttribute($entity, 'attribute_2', array(
          'type' =&gt; 'text',
          'label' =&gt; 'Attribute 2',
          'input' =&gt; 'text',
          'visible' =&gt; TRUE,
          'required' =&gt; FALSE,
          'default_value' =&gt; '',
          'adminhtml_only' =&gt; '0'
  ));
  
  $forms = array(
      'adminhtml_customer',
      'customer_account_edit'
  );
  $attribute = Mage::getSingleton('eav/config')-&gt;getAttribute($installer-&gt;getEntityTypeId('customer'), 'attribute_2');
  $attribute-&gt;setData('used_in_forms', $forms);
  $attribute-&gt;save();
  
  $installer-&gt;endSetup();
  </code></pre>
  
  <p>and uploaded the new file and went back onto the site <code>attribute_2</code> would be added but it isn't.</p>
  
  <p>Why does this work once but not again?</p>