You are here

function simple_sitemap_update_8210 in Simple XML sitemap 8.3

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

Adding 'type' and 'delta' fields to simple_sitemap table.

File

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

Code

function simple_sitemap_update_8210() {
  $database = \Drupal::database();
  $database
    ->truncate('simple_sitemap')
    ->execute();
  if (!$database
    ->schema()
    ->fieldExists('simple_sitemap', 'type')) {
    $database
      ->schema()
      ->addField('simple_sitemap', 'type', [
      'description' => 'Type of sitemap this chunk belongs to.',
      'type' => 'varchar',
      'length' => 50,
      'not null' => TRUE,
      'default' => '',
    ]);
  }
  if (!$database
    ->schema()
    ->fieldExists('simple_sitemap', 'delta')) {
    $database
      ->schema()
      ->addField('simple_sitemap', 'delta', [
      'description' => 'Delta of the chunk within the type scope.',
      'type' => 'int',
      'size' => 'small',
      'not null' => TRUE,
      'unsigned' => TRUE,
    ]);
  }
}