hi there,

the documentation says schema's are automatically removed on module uninstall but that doesn't seem to be the case.

What do I do to make it happen automatically? It's a bit of a pain to constantly drop a table while developing

Matt.

Comments

WorldFallz’s picture

If you've defined the schema properly it should definitely work. Make sure you're completely uninstalling the module and not just disabling it.

Jaypan’s picture

Seconded.

matthias_bauw’s picture

I am uninstalling through the designated tab. But tables don't get dropped.

Maybe something in the code?

function audition_schema(){
  $schema['audition_candidate'] = array(
    'description'=>'stores all the candidates for an audition',
    'fields'=>array(
      'id'=>array(
        'description'=>'identifier for candidate',
        'type'=>'serial',
        'not null'=>TRUE,
        'unsigned'=>TRUE,
      ),
      'lastname'=>array(
        'description'=>'candidate last name',
        'type'=>'varchar',
        'length'=>'50',
        'not null'=>TRUE,
      ),
      'firstname'=>array(
        'description'=>'candidate first name',
        'type'=>'varchar',
        'length'=>'50',
        'not null'=>TRUE,
      ),
      'mailadress'=>array(
        'description'=>'candidate mail adress',
        'type'=>'varchar',
        'length'=>'255',
        'not null'=>TRUE,
      ),
      'vocalgroup'=>array(
        'description'=>'candidate vocal group type',
        'type'=>'int',
        'length'=>'small',
        'not null'=>TRUE,
      ),
    ),
    'primary key' =>array('id'),
    'label' => array('lastname','firstname'),
  );
  
  $schema['vocal_group'] = array(
    'description'=>'Stores the different vocal groups',
    'fields'=>array(
      'id'=>array(
        'description'=>'identifier for vocal group',
        'type'=>'serial',
        'not null'=>TRUE,
        'unsigned'=>TRUE,
      ),
      'group'=>array(
        'description'=>'vocal group name',
        'type'=>'varchar',
        'length'=>'50',
        'not null'=>TRUE,
      ),
    ),
    'primary key' =>array('id'),
    'uri callback' => 'entity_class_uri',
  );
  
  return $schema;
}
Jaypan’s picture

Two questions:

1) Is your module key: audition?
2) Are you definitely on Drupal 7?

matthias_bauw’s picture

both times yes :)