Node type created by custom module doesn't get updated I'm working on a custom module that creates a new content type. Recently I added a new field to the content type, but it doesn't get updated. I don't have any nodes of this type and when I disable my module, the content type is deleted. After I enable it again, the content type is back, but with the old setup and without the newly added field.
I'm probably overlooking something very basic, but I couldn't figure out what. I cleared the cache and run cron before and after I disabled and enabled my module.

I even tried to give a different name to my content type and fields, but then the content type is not created. I bet it's just some small mistyping or something.

What could be the problem?

Here is the code. I put the field arrays into functions, but I don't think this causes any problem.

function simplegal_node_info() {
  return array(
    'simplegal' =&gt; array(
      'name' =&gt; t('Simple Gallery'),      
      'base' =&gt; 'simplegal',
      'description' =&gt; t('A simple gallery that will display all images from a given directory'),
      'title_label' =&gt; t('Title of gallery'),      
      'locked' =&gt; TRUE,
    ),
  );
}
function simplegal_node_type_insert($content_type) {
  if ($content_type-&gt;type == 'simplegal') {
    $body_instance = node_add_body_field($content_type, t('Description'));
    field_update_instance($body_instance);
    foreach (_simplegal_installed_fields() as $field) {
      field_create_field($field);
    }
    foreach (_simplegal_installed_instances() as $instance) {
      $instance['entity_type'] = 'node';
      $instance['bundle'] = 'simplegal';
      field_create_instance($instance);
    }
  }
}

function _simplegal_installed_fields() {
  return array(
    'simplegal_gallery_dir' =&gt; array(
      'field_name' =&gt; 'simplegal_gallery_dir',
      'cardinality' =&gt; 1,
      'type'        =&gt; 'text',
      'settings'    =&gt; array(
        'max_length' =&gt; 60,
      ),
    ),
    'simplegal_thumb_width' =&gt; array(
      'field_name' =&gt; 'simplegal_thumb_width',
      'cardinality' =&gt; 1,
      'type'        =&gt; 'text',
      'settings'    =&gt; array(
        'max_length' =&gt; 10,
      ),      
    ),
    'simplegal_thumb_height' =&gt; array(
      'field_name' =&gt; 'simplegal_thumb_height',
      'cardinality' =&gt; 1,
      'type'        =&gt; 'text',
      'settings'    =&gt; array(
        'max_length' =&gt; 10,
      ),
    ),
  );
}
function _simplegal_installed_instances() {
  return array(
    'simplegal_gallery_dir' =&gt; array(
      'field_name' =&gt; 'simplegal_gallery_dir',
      'label'       =&gt; t('The directory of the gallery'),
      'widget'      =&gt; array(
        'type'    =&gt; 'text_textfield',
      ),      
    ),
    'simplegal_thumb_width' =&gt; array(
      'field_name' =&gt; 'simplegal_thumb_width',
      'label'       =&gt; t('Width of thumbnails'),
      'widget'      =&gt; array(
        'type'    =&gt; 'text_textfield',
      ),      
      'default_value' =&gt; variable_get('simplegal_thumb_width',120),
    ),
    'simplegal_thumb_height' =&gt; array(
      'field_name' =&gt; 'simplegal_thumb_height',
      'label'       =&gt; t('Height of thumbnails'),
      'widget'      =&gt; array(
        'type'    =&gt; 'text_textfield',
      ),
      'default_value' =&gt; variable_get('simplegal_thumb_height',120),
    ),
  );
}
My wild guess is:

From hook_node_type_insert documentation:


  Respond to node type creation.
  This hook is invoked from node_type_save() after the node type is added to the database.


Because you're not "Uninstalling" the module after you disable it, the content type will be kept, but it will simply be flagged as "Disabled" in the "disabled" column in the {node_type} table.

Therefore that hook is not invoked when you re-enable the module, hence the new fields not added.

So what you need to do is after disabling the module, go to the Uninstall tab and uninstall it, or if you're using drush:

drush dis -y simplegal &amp;&amp; drush pm-uninstall -y simplegal