You are here

function radioactivity_schema in Radioactivity 7.2

Same name and namespace in other branches
  1. 6 radioactivity.install \radioactivity_schema()
  2. 7 radioactivity.install \radioactivity_schema()

Implements hook_schema.

File

./radioactivity.install, line 58

Code

function radioactivity_schema() {
  $schema = array();
  $schema['radioactivity_deferred_incidents'] = array(
    'description' => 'Deferred incident storage table for radioactivity',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Row ID',
      ),
      'data' => array(
        'type' => 'varchar',
        'length' => 1000,
        'not null' => TRUE,
        'description' => 'Serialized data',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['radioactivity_decay_profile'] = array(
    'description' => 'Radioactivity decay profiles',
    'export' => array(
      'key' => 'machine_name',
      'key name' => 'Name',
      'primary key' => 'machine_name',
      'identifier' => 'radioactivity_decay_profile',
      // Function hook name.
      'default hook' => 'default_radioactivity_decay_profile',
      'api' => array(
        'owner' => 'radioactivity',
        // Base name for api include files.
        'api' => 'radioactivity_decay_profile',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'machine_name' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'description' => 'Machine name for the profile',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'description' => 'Name for the profile',
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Description',
      ),
      'enable_decay' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => '1',
        'description' => 'Is the energy decay active',
      ),
      'granularity' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '60',
        'description' => 'Accuracy of the modelling',
      ),
      'half_life' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => "21600",
        'description' => 'Half life',
      ),
      'cut_off' => array(
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
        'default' => "0.1",
        'description' => 'Cut off',
      ),
      'storage' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => 'live',
        'description' => 'Storage type for the profile',
      ),
    ),
    'primary key' => array(
      'machine_name',
    ),
  );
  $schema['radioactivity_flood_map'] = array(
    'description' => 'Maps a source to a time - used to keep track of incidents from a source',
    'fields' => array(
      'source' => array(
        'type' => 'char',
        'length' => '32',
        'not null' => TRUE,
        'description' => 'Source',
      ),
      'time' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unix timestamp',
      ),
    ),
    'primary key' => array(
      'source',
    ),
  );
  $schema['radioactivity_history'] = array(
    'description' => 'History storage table for radioactivity',
    'fields' => array(
      'field_instance_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Field instance id',
      ),
      'entity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Entity ID',
      ),
      'time' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unix timestamp',
      ),
      'energy' => array(
        'type' => 'float',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Energy',
      ),
    ),
    'indexes' => array(
      'main' => array(
        'field_instance_id',
        'entity_id',
      ),
    ),
  );
  return $schema;
}