Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
gregglesYour 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.
Comment #2
joachim CreditAttribution: joachim as a volunteer commented> 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?