I am making a module, and created a MySQL table with a field of type ENUM. I then went to admin/build/schema/inspect and copied the generated schema for my table, which included this:

  $schema['cscontent_destinations'] = array(
  'description' => t('Information about content destinations for cscontent module.'),
  'fields' => array(
    'type' => array(
      'description' => t('What kind of destination is this going to?'),
      'type' => 'enum',
      'not null' => TRUE,
    ),
);

You can see the 'type' => 'enum', which is not supported by the core scheme API. This should probably default to an int, or give a warning that enum is not supported by core.

Comments

greggles’s picture

Title: Schema exports MySQL enums as 'type' => 'enum' when the core Schema API doesn't support it » Provide a warning that enum is not supported when generating schema for a table
Version: 6.x-1.7 » 7.x-1.x-dev
Category: Bug report » Feature request
Issue summary: View changes

Your proposal of making a warning seems like a good idea to me. That feels like a feature so I'm updating the category and version and title to reflect that focus.

joachim’s picture

> You can see the 'type' => 'enum', which is not supported by the core scheme API.

You mean by Drupal core's Schema API?

I'm not sure that it's up to this module to warn of incorrect usage of that. The valid data types are documented here: https://www.drupal.org/docs/7/api/schema-api/data-types

Feasibly, core could throw an exception if 'type' is something it doesn't support?