You are here

track_field_changes.install in Track Field Changes 8

Same filename and directory in other branches
  1. 7 track_field_changes.install

File

track_field_changes.install
View source
<?php

/**
 * Implements hook_uninstall().
 */
function track_field_changes_uninstall() {

  // Clear variables.
  \Drupal::config('track_field_changes.settings')
    ->delete();
}

/**
 * Implements hook_schema().
 */
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;
}

Functions