You are here

function radioactivity_schema in Radioactivity 6

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

@file Radioactivity core db schema and install hooks.

File

./radioactivity.install, line 7
Radioactivity core db schema and install hooks.

Code

function radioactivity_schema() {
  $schema = array();
  $schema['radioactivity'] = array(
    'description' => t('The table for energy information on various radioactive objects'),
    'fields' => array(
      'id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The object identifier. Nid for nodes, cid for comments, uid for users, etc'),
      ),
      'class' => array(
        'type' => 'varchar',
        'length' => 7,
        'not null' => TRUE,
        'default' => '',
        'description' => t('The object class. node, comment, user, etc'),
      ),
      'decay_profile' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The decay profile id'),
      ),
      'energy' => array(
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The object energy, i.e., the amount of radioactivity'),
      ),
      'last_emission_timestamp' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The moment when the energy reduction was last performed. Unix timestamp.'),
      ),
    ),
    'primary key' => array(
      'id',
      'class',
      'decay_profile',
    ),
    'indexes' => array(
      'radioactivity_ix_energy' => array(
        'energy',
      ),
    ),
  );
  return $schema;
}