I'm trying to create a field in code to use the Video Embed Field module, and getting the following when I try enabling modules after an install:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'field_video_fid' doesn't exist in table: CREATE TABLE {field_data_field_video} ( `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_video_video_url` VARCHAR(512) DEFAULT '', `field_video_thumbnail_path` VARCHAR(512) DEFAULT '', `field_video_video_data` LONGBLOB NULL DEFAULT NULL, `field_video_embed_code` VARCHAR(1024) DEFAULT '', `field_video_description` TEXT 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_video_fid` (`field_video_fid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Data storage for field 18 (field_video)'; Array ( ) in db_create_table() (line 2684 of /var/www/html/cod_d7/includes/database/database.inc).

My field config definition is:

  // Exported field: field_video
  $fields['node-session-field_video'] = array(
    'field_config' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'field_video',
      'foreign keys' => array(
        'fid' => array(
          'columns' => array(
            'fid' => 'fid',
          ),
          'table' => 'file_managed',
        ),
      ),
      'indexes' => array(
        'fid' => array(
          0 => 'fid',
        ),
      ),
      'primary key' => array('fid'),
      'module' => 'video_embed_field',
      'settings' => array(
        'display_default' => 1,
        'display_field' => 1,
        'field_permissions' => array(
          'create' => 'create',
          'edit' => 0,
          'edit own' => 'edit own',
          'view' => 'view',
          'view own' => 0,
        ),        
        'uri_scheme' => 'public',
      ),
      'translatable' => '1',
      'type' => 'video_embed_field',
    ),

Comments

VM’s picture

does your new module which is creating the field have a .install in it?

sunset_bill’s picture

No, this is happening in a features.field.inc file. It works with a field type of 'file' and breaks when I try to make it 'video_embed_field' (trying to use the Video Embed Field module).