You are here

function simple_sitemap_schema in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 simple_sitemap.install \simple_sitemap_schema()
  2. 8.2 simple_sitemap.install \simple_sitemap_schema()

Implements hook_schema().

File

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

Code

function simple_sitemap_schema() {
  $schema['simple_sitemap'] = [
    'description' => 'Holds XML sitemaps as strings for quick retrieval.',
    'fields' => [
      'id' => [
        'description' => 'Sitemap chunk unique identifier.',
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ],
      'type' => [
        'description' => 'Type of sitemap this chunk belongs to.',
        'type' => 'varchar',
        'length' => \Drupal\Core\Entity\EntityTypeInterface::ID_MAX_LENGTH,
        'not null' => TRUE,
        'default' => '',
      ],
      'delta' => [
        'description' => 'Delta of the chunk within the type scope.',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ],
      'sitemap_string' => [
        'description' => 'XML sitemap chunk string.',
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
      ],
      'sitemap_created' => [
        'description' => 'Timestamp of sitemap chunk generation.',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ],
      'status' => [
        'description' => 'Flag indicating the publishing status of the chunk.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ],
      'link_count' => [
        'description' => 'The number of links in the sitemap.',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'id',
    ],
    'indexes' => [
      'type_status_delta' => [
        'type',
        'status',
        'delta',
      ],
    ],
  ];
  $schema['simple_sitemap_entity_overrides'] = [
    'description' => 'Holds sitemap settings overridden by entities.',
    'fields' => [
      'id' => [
        'description' => 'Override unique identifier.',
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ],
      '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' => \Drupal\Core\Entity\EntityTypeInterface::BUNDLE_MAX_LENGTH,
        'not null' => TRUE,
      ],
      'entity_id' => [
        'description' => 'ID of the overriding entity.',
        'type' => 'varchar',
        'length' => \Drupal\Core\Entity\EntityTypeInterface::ID_MAX_LENGTH,
        'not null' => TRUE,
      ],
      'inclusion_settings' => [
        'description' => 'Setting for the overriding entity.',
        'type' => 'blob',
      ],
    ],
    'primary key' => [
      'id',
    ],
    'indexes' => [
      'entity_key' => [
        'type',
        'entity_type',
        'entity_id',
      ],
    ],
  ];
  return $schema;
}