You are here

function simple_sitemap_update_8303 in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 4.x simple_sitemap.install \simple_sitemap_update_8303()

Add indexes to the simple_sitemap and simple_sitemap_entity_overrides tables.

File

./simple_sitemap.install, line 740
Module install and update procedures.

Code

function simple_sitemap_update_8303() {
  $schema = Database::getConnection()
    ->schema();
  $spec = [
    'fields' => [
      'type' => [
        'description' => 'Type of sitemap this chunk belongs to.',
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ],
      'delta' => [
        'description' => 'Delta of the chunk within the type scope.',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ],
      'status' => [
        'description' => 'Flag indicating the publishing status of the chunk.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ],
    ],
  ];
  $schema
    ->addIndex('simple_sitemap', 'type_status_delta', [
    'type',
    'status',
    'delta',
  ], $spec);
  $spec = [
    'fields' => [
      'type' => [
        'description' => 'Type of sitemap this override belongs to.',
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
      ],
      'entity_type' => [
        'description' => 'Entity type of the overriding entity.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ],
      'entity_id' => [
        'description' => 'ID of the overriding entity.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ],
    ],
  ];
  $schema
    ->addIndex('simple_sitemap_entity_overrides', 'entity_key', [
    'type',
    'entity_type',
    'entity_id',
  ], $spec);
}