You are here

function radioactivity_schema in Radioactivity 7

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

Implementation of hook_schema

File

./radioactivity.install, line 23

Code

function radioactivity_schema() {
  $schema = array();
  $schema['radioactivity_deferred_storage'] = array(
    'description' => 'Deferred storage table for radioactivity',
    'fields' => array(
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'description' => 'Type of the entity',
      ),
      'entity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Entity identifier',
      ),
      'field_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Field identifier',
      ),
      'energy' => array(
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Amount of energy this action produced',
      ),
      'emission_time' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Time of the emission',
      ),
    ),
    //'primary key' => array('entity_type', 'entity_id', 'field_id'),
    'indexes' => array(
      'main' => array(
        'entity_type',
        'entity_id',
        'field_id',
      ),
    ),
  );
  return $schema;

  /*
  $schema['radioactivity_deferred_store'] =
    array('description' => 'The table where DbStore puts deferred entries',
          'fields' =>
          array('entry_id' => array('type' => 'serial',
                                    'size' => 'big',
                                    'not null' => TRUE,
                                    'description' => 'Entry identifier'),
                'entry_type' => array('type' => 'varchar',
                                      'length' => 10,
                                      'not null' => TRUE,
                                      'description' => 'Entry type, e.g., add-energy'),
                'id' => array('type' => 'int',
                              'unsigned'=> TRUE,
                              'not null' => TRUE,
                              'description' => 'The object identifier. Nid for nodes, cid for comments, uid for users, etc'),
                'class' => array('type' => 'varchar',
                                 'length' => 7,
                                 'not null' => TRUE,
                                 'description' => 'The object class. node, comment, user, etc'),
                'source' => array('type' => 'varchar',
                                  'length' => 16,
                                  'not null' => TRUE,
                                  'description' => 'The energy source, e.g., node_view'),
                'multiplier' => array('type' => 'float',
                                      'size' => 'big',
                                      'not null' => TRUE,
                                      'description' => 'Energy multiplier'),
          ),
          'primary key' => array('entry_id')
    );

  return $schema;
  */
}