title: Deleting instances / fields - Drupal 7
body: <p>I am having some difficulties with my module I am currently working on.  As part of this module I have created a few fields that appear on a form.  This form is based in a custom entity.</p>
  
  <p>First I am using <code>field_create_field($field);</code> to create the row in the <code>field_config</code> table.  I am then using <code>field_create_instance($instance);</code> to create the row in the instance table and also create the table that begins with <code>field_data_field</code>.  </p>
  
  <p>The problem I am running into is how to remove these tables correctly at the end.  I have tried manual deletion (via hook_uninstall), I've tried field_delete_field, I've tried to use the remove_instance hook that is built into the Commerce module.  Either way, I end up getting lots of <code>field_deleted_data_xxx</code> tables being created.  These don't even have data in them as I created a manual query to empty the main data tables before this function was called that seems to create these tables.</p>
  
  <p>Has anyone else ever run into this problem?  How do I stop Drupal from creating these tables??</p>