You are here

function homebox_schema in Homebox 7.2

Same name and namespace in other branches
  1. 6.3 homebox.install \homebox_schema()
  2. 6 homebox.install \homebox_schema()
  3. 6.2 homebox.install \homebox_schema()
  4. 7.3 homebox.install \homebox_schema()

Implements hook_schema().

File

./homebox.install, line 11
The install file for Homebox allows the module to install (and uninstall) itself. This is required as this module uses its own table.

Code

function homebox_schema() {

  // Schema for homebox pages
  $schema['homebox_pages'] = array(
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'settings' => array(
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
        'object default' => array(),
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );

  // Schema for user custom settings
  $schema['homebox_users'] = array(
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'settings' => array(
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
        'object default' => array(),
      ),
    ),
    'primary key' => array(
      'uid',
      'name',
    ),
  );
  return $schema;
}