You are here

function analytics_schema in Analytics 7

Same name and namespace in other branches
  1. 6 analytics.install \analytics_schema()

Implements hook_schema().

File

./analytics.install, line 6

Code

function analytics_schema() {
  $schema['analytics_service'] = array(
    'description' => '',
    'fields' => array(
      'sid' => array(
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'no export' => TRUE,
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
      ),
      'service' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'locked' => array(
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
      'options' => array(
        'type' => 'blob',
        'size' => 'big',
        'not null' => FALSE,
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'sid',
    ),
    'unique keys' => array(
      'machine_name' => array(
        'machine_name',
      ),
    ),
    'export' => array(
      'key' => 'machine_name',
      'key name' => 'Machine name',
      'primary key' => 'sid',
      'identifier' => 'service',
      'default hook' => 'analytics_default_service',
      'cache defaults' => TRUE,
      'api' => array(
        'owner' => 'analytics',
        'api' => 'analytics_default_service',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
  );
  return $schema;
}