content_sync-8.x-2.x-dev/content_sync.install

content_sync.install
<?php
/**
 * @file
 * Install, update and uninstall functions for the content_sync module.
 */

/**
 * Implements hook_install().
 */
function content_sync_install(){
  //Create the content snapshot.
  $cs_snapshoot = Drupal::service('content_sync.snaphoshot');
  $cs_snapshoot->snapshot();
}

/**
 * Implements hook_schema().
 */
function content_sync_schema() {
  // Content Sync Table - DB Snapshot.
  $schema['cs_db_snapshot'] = [
    'description' => 'The base table for content data.',
      'fields' => [
      'collection' => [
        'description' => 'Primary Key: Content object collection.',
        'type' => 'varchar_ascii',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'name' => [
        'description' => 'Primary Key: Content object name.',
        'type' => 'varchar_ascii',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'data' => [
        'description' => 'A serialized content object data.',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ],
    ],
    'primary key' => ['collection', 'name'],
  ];
  // Content Sync Logs Table
  $schema['cs_logs'] = [
    'description' => 'Table that contains content_sync logs.',
    'fields' => [
      'csid' => [
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique content_sync event ID.',
      ],
      'uid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {users}.uid of the user who triggered the event.',
      ],
      'type' => [
        'type' => 'varchar_ascii',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Type of log message, for example "Import" or "Export"',
      ],
      'message' => [
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => 'Text of log message to be passed into the t() function.',
      ],
      'variables' => [
        'type' => 'blob',
        'not null' => TRUE,
        'size' => 'big',
        'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.',
      ],
      'severity' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
      ],
      'link' => [
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Link to view the result of the event.',
      ],
      'location'  => [
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'URL of the origin of the event.',
      ],
      'referer' => [
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'URL of referring page.',
      ],
      'hostname' => [
        'type' => 'varchar_ascii',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Hostname of the user who triggered the event.',
      ],
      'timestamp' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Unix timestamp of when event occurred.',
      ],
    ],
    'primary key' => ['csid'],
    'indexes' => [
      'type' => ['type'],
      'uid' => ['uid'],
      'severity' => ['severity'],
    ],
  ];

  return $schema;
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc