You are here

function entity_update_drush_command in Entity Update 8

Same name and namespace in other branches
  1. 2.0.x drush/entity_update.drush8.inc \entity_update_drush_command()

Implements hook_drush_command().

File

./entity_update.drush.inc, line 17
Entity update module (entity_update).

Code

function entity_update_drush_command() {
  $items = [];

  // Entity update operations.
  $items['entity-update'] = [
    'description' => 'Update Entity type Schema',
    'aliases' => [
      'upe',
    ],
    'arguments' => [
      'type' => dt('The entity type ID to update'),
    ],
    'options' => [
      'show' => dt('Show entities to update'),
      'basic' => dt('Update all entities as basic way'),
      'force' => dt('Try force update'),
      'all' => dt('Update all Entities'),
      'nobackup' => dt('Disable automatic full database backup (Not recommended)'),
      'clean' => dt('Cleanup entity backup database'),
      'bkpdel' => dt('Copy entities to update in to backup database and delete entities'),
      'rescue' => dt('Create entities from entity backup database'),
    ],
    'examples' => [
      'drush upe --show' => 'Show entities to update.',
      'drush upe --basic' => 'Update entities. Run this command if all entities to update are empty. Else Exception.',
      'drush upe --all' => 'Update entities with data. Run this command if any entity (to update) has data.',
      'drush upe --basic --nobackup' => 'Update all without automatic database backup.',
      'drush upe --basic --force --nobackup' => 'Try to update using basic method even having data.',
      'drush upe --all --nobackup' => 'Update all without automatic database backup (Not recommended).',
      'drush upe --clean' => 'Cleanup entity backup database.',
      'drush upe --bkpdel' => 'Copy entities to update in to backup database and delete entities.',
      'drush upe --rescue' => 'If entity recreation failed, You can you this option to create entities from entity backup database.',
      'drush upe ENTITY_TYPE_ID --nobackup' => 'Update entity type ENTITY_TYPE_ID.',
    ],
  ];

  // Check an entity type.
  $items['entity-check'] = [
    'description' => 'Check an Entity',
    'aliases' => [
      'upec',
    ],
    'arguments' => [
      'type' => dt('The entity type ID'),
    ],
    'options' => [
      'types' => dt('Show entity types list'),
      'list' => dt('Show entities list'),
      'length' => dt('Number of entities to show'),
      'start' => dt('Start from'),
    ],
    'examples' => [
      'drush upec node' => 'Show The entity summery.',
      'drush upec --types' => 'Show all entity types list.',
      'drush upec block --types ' => 'Show all entity types list contains "block"',
      'drush upec node --list' => 'Show 10 entities.',
      'drush upec node --list --length=0' => 'Show all entities.',
      'drush upec node --list --start=2 --length=3' => 'Show 3 entities from 2.',
    ],
  ];
  return $items;
}