You are here

public function PushQueue::schemaDefinition in Salesforce Suite 8.3

Same name and namespace in other branches
  1. 8.4 modules/salesforce_push/src/PushQueue.php \Drupal\salesforce_push\PushQueue::schemaDefinition()
  2. 5.0.x modules/salesforce_push/src/PushQueue.php \Drupal\salesforce_push\PushQueue::schemaDefinition()

Defines the schema for the queue table.

Overrides DatabaseQueue::schemaDefinition

File

modules/salesforce_push/src/PushQueue.php, line 326

Class

PushQueue
Salesforce push queue.

Namespace

Drupal\salesforce_push

Code

public function schemaDefinition() {
  return [
    'description' => 'Drupal entities to push to Salesforce.',
    'fields' => [
      'item_id' => [
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary Key: Unique item ID.',
      ],
      'name' => [
        'type' => 'varchar_ascii',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The salesforce mapping id',
      ],
      'entity_id' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The entity id',
      ],
      'mapped_object_id' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Foreign key for salesforce_mapped_object table.',
      ],
      'op' => [
        'type' => 'varchar_ascii',
        'length' => 16,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The operation which triggered this push',
      ],
      'failures' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Number of failed push attempts for this queue item.',
      ],
      'expire' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp when the claim lease expires on the item.',
      ],
      'created' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp when the item was created.',
      ],
      'updated' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp when the item was created.',
      ],
    ],
    'primary key' => [
      'item_id',
    ],
    'unique keys' => [
      'name_entity_id' => [
        'name',
        'entity_id',
      ],
    ],
    'indexes' => [
      'entity_id' => [
        'entity_id',
      ],
      'name_created' => [
        'name',
        'created',
      ],
      'expire' => [
        'expire',
      ],
    ],
  ];
}