(first off - thanks - this module is really helping me to learn about entities).
ISSUE:
It doesn't seem that model entity fields are deleted upon uninstall.

To Recreate:
1. Install MODEL and create a Model Type with at least one custom field.
2. Create a record of this model type.
3. Deactivate MODEL then Uninstall MODEL.
4. Use myphpadmin or other tool to look in your MySQL db. The fields are still there.

Comments

Anonymous’s picture

Issue summary: View changes

Try this

/**
 * Implements hook_uninstall().
 *
 * At uninstall time we'll notify field.module that the entity was deleted
 * so that attached fields can be cleaned up.
 *
 */
function models_uninstall() {
  // Delete all attached field instances of all models bundles
  $types = db_select('models_type', 't')->fields('t')->execute()->fetchAllAssoc('type');
  foreach($types as $type => $info){
	field_attach_delete_bundle('models', $type);
  }
}
Anybody’s picture

@#1 shouldn't it be model (without "s"?) in all occurencies?

Please add a patch and lets review this to get it RTBC :)