How to add image field to module install file How to add image field to database in module install file? I found on api documentation, that type is image, so tried the following code: 

function profile_bg_schema() {

$schema = array();

$schema['profile_bg'] = array(
  'description' =&gt; 'The table containing backgrounds',
  'fields' =&gt; array(
    'bid' =&gt; array(
      'description' =&gt; 'The primary identifier for the background.',
      'type' =&gt; 'serial',
      'unsigned' =&gt; TRUE,
      'not null' =&gt; TRUE,
    ),
    'image' =&gt; array(
      'description' =&gt; 'The background image.',
      'type' =&gt; 'image',
      'not null' =&gt; TRUE,
      'default' =&gt; '',
    ),
    'class' =&gt; array(
      'description' =&gt; 'The class added to div.',
      'type' =&gt; 'varchar',
      'length' =&gt; 255,
      'not null' =&gt; TRUE,
      'default' =&gt; '',
    ),
  ),
  'primary key' =&gt; array('bid'),
);


$schema['profile_bg_unlock'] = array(
  'description' =&gt; 'User - background - active table',
  'fields' =&gt; array(
    'uid' =&gt; array(
      'description' =&gt; 'User ID.',
      'type' =&gt; 'int',
      'unsigned' =&gt; TRUE,
      'not null' =&gt; TRUE,
    ),
     'bid' =&gt; array(
      'description' =&gt; 'Background ID.',
      'type' =&gt; 'int',
      'unsigned' =&gt; TRUE,
      'not null' =&gt; TRUE,
    ),
    'status' =&gt; array(
      'description' =&gt; 'The primary identifier for the background.',
      'type' =&gt; 'int',
      'unsigned' =&gt; TRUE,
      'not null' =&gt; TRUE,
      'default' =&gt; '0',
    ),
  ),
);

return $schema;

}


First I was getting an error about image field, now module becomes ON, but nothing changes in database.

---- EDIT ----
Error below. It looks like Drupal do not know what type of field should create in database.

   Notice: Undefined index: image:normal w DatabaseSchema_mysql-&gt;processField() (linia 205 z C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\drupal\includes\database\mysql\schema.inc).
    PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL COMMENT 'Background Img.', `class` VARCHAR unsigned NOT NULL DEFAU' at line 3: CREATE TABLE {profile_bg} ( `bid` INT unsigned NOT NULL COMMENT 'bg ID.', `image` DEFAULT NULL COMMENT 'Background Img.', `class` VARCHAR unsigned NOT NULL DEFAULT '' COMMENT 'css class for the background.', PRIMARY KEY (`bid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'background table'; Array ( ) w db_create_table() (linia 2720 z C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\drupal\includes\database\database.inc).
You are reading the wrong documentation. Please read Data Types instead. There is no image type for database field.

The available data type are:


serial
int
float
numeric
varchar
char
text
blob


Since Drupal manage file (including image files) in file_managed table with key fid. What you need is to create a int column for storing the value of foreign key fid. The column definition should be:

'image_fid' =&gt; array(
  'description' =&gt; 'The {file_managed}.fid being referenced in this field.',
  'type' =&gt; 'int',
  'not null' =&gt; FALSE,
  'unsigned' =&gt; TRUE,
),