I'm walking through setting up my own custom fields for the first time. I created a field that I wanted to store YouTube embed code within. I noticed it had a Max Char of 255.I set the number to something large like 111111, and when I hit save I got a red error message, something about MySQL. I figured that the number I entered was probably invalid (if so, it would be nice if Drupal prohibited invalid values).
Anyway, I figured I could just delete the field and re-create it using the same machine name. However, it seems there is still a corruption in the database around that machine name because now I to get the following error on every administration screen:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.field_data_field_embed_code' doesn't exist: SELECT field_data_field_embed_code0.entity_type AS entity_type, field_data_field_embed_code0.entity_id AS entity_id, field_data_field_embed_code0.revision_id AS revision_id, field_data_field_embed_code0.bundle AS bundle FROM {field_data_field_embed_code} field_data_field_embed_code0 WHERE (field_data_field_embed_code0.deleted = :db_condition_placeholder_0) AND (field_data_field_embed_code0.bundle = :db_condition_placeholder_1) LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => video_audio ) in field_sql_storage_field_storage_query() (line 568 of /var/mansion/www/d/modules/field/modules/field_sql_storage/field_sql_storage.module).
where do I need to go to completely purge the database of any reference to the field name embed_code, so that I can re-create it safely? Or is this something I can do within the Drupal UI itself?
Comments
some more info
Poking around in the reports screen, I found the original error:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1074 Column length too big for column 'field_embed_code_value' (max = 21845); use BLOB or TEXT instead: CREATE TABLE {field_data_field_embed_code} ( `entity_type` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The entity type this data is attached to', `bundle` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance', `deleted` TINYINT NOT NULL DEFAULT 0 COMMENT 'A boolean indicating whether this data item has been deleted', `entity_id` INT unsigned NOT NULL COMMENT 'The entity id this data is attached to', `revision_id` INT unsigned NULL DEFAULT NULL COMMENT 'The entity revision id this data is attached to, or NULL if the entity type is not versioned', `language` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The language for this data item.', `delta` INT unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields', `field_embed_code_value` VARCHAR(11111111) NULL DEFAULT NULL, `field_embed_code_format` VARCHAR(255) NULL DEFAULT NULL, PRIMARY KEY (`entity_type`, `entity_id`, `deleted`, `delta`, `language`), INDEX `entity_type` (`entity_type`), INDEX `bundle` (`bundle`), INDEX `deleted` (`deleted`), INDEX `entity_id` (`entity_id`), INDEX `revision_id` (`revision_id`), INDEX `language` (`language`), INDEX `field_embed_code_format` (`field_embed_code_format`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Data storage for field 10 (field_embed_code)'; Array ( ) in db_create_table() (line 2657 of /var/mansion/www/d/includes/database/database.inc).
this could easily have been prevented if Drupal do not allow me to enter an invalid amount or even if it just suggested a maximum amount of in a comment blurb.
though I am still dead in the water; any ideas?
My solution
I manually deleted the relevant table row from field_config and field_config_instance. That appears to have solved the issue.