You are here

function track_field_changes_schema in Track Field Changes 8

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

Implements hook_schema().

File

./track_field_changes.install, line 14

Code

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