You are here

function track_field_changes_schema in Track Field Changes 7

Same name and namespace in other branches
  1. 8 track_field_changes.install \track_field_changes_schema()

Implements hook_schema().

File

./track_field_changes.install, line 26
The Track Field Changes install.

Code

function track_field_changes_schema() {
  $schema['track_field_changes_audit'] = array(
    'description' => 'Mark wich field need to be audited',
    'fields' => array(
      'nid' => array(
        'description' => 'The {node}.nid this record tracks.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'timestamp' => array(
        'description' => 'The Unix timestamp when the change has been created',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'field_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'description' => 'The name of this field.',
      ),
      'before_value_text' => array(
        'description' => '',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
      ),
      'after_value_text' => array(
        'description' => '',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
      ),
      'type' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => 8,
        'not null' => TRUE,
        'default' => '',
      ),
      'log' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => 256,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'track_field_changes' => array(
        'nid',
        'field_name',
      ),
    ),
  );
  $schema['track_field_changes'] = array(
    'fields' => array(
      'field_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'bundle' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'track_field_changes' => array(
        'field_name',
        'bundle',
      ),
    ),
    'primary key' => array(
      'field_name',
      'bundle',
    ),
  );
  return $schema;
}