You are here

function xmlsitemap_schema in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 xmlsitemap.install \xmlsitemap_schema()
  2. 6.2 xmlsitemap.install \xmlsitemap_schema()
  3. 6 xmlsitemap.install \xmlsitemap_schema()
  4. 7.2 xmlsitemap.install \xmlsitemap_schema()

Implements hook_schema().

File

./xmlsitemap.install, line 190
Install, update and uninstall functions for the xmlsitemap module.

Code

function xmlsitemap_schema() {

  // @todo Rename to xmlsitemap_link
  $schema['xmlsitemap'] = [
    'description' => 'The base table for xmlsitemap links.',
    'fields' => [
      'id' => [
        'description' => 'Primary key with type; a unique id for the item.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ],
      'type' => [
        'description' => 'Primary key with id; the type of item (e.g. node, user, etc.).',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ],
      'subtype' => [
        'description' => 'A sub-type identifier for the link (node type, menu name, term VID, etc.).',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'loc' => [
        'description' => 'The URL to the item relative to the Drupal path.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'language' => [
        'description' => 'The {languages}.language of this link or an empty string if it is language-neutral.',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ],
      'access' => [
        'description' => 'A boolean that represents if the item is viewable by the anonymous user. This field is useful to store the result of node_access() so we can retain changefreq and priority_override information.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ],
      'status' => [
        'description' => 'An integer that represents if the item is included in the sitemap.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ],
      'status_override' => [
        'description' => 'A boolean that if TRUE means that the status field has been overridden from its default value.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ],
      'lastmod' => [
        'description' => 'The UNIX timestamp of last modification of the item.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'priority' => [
        'description' => 'The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0.',
        'type' => 'float',
        'default' => NULL,
      ],
      'priority_override' => [
        'description' => 'A boolean that if TRUE means that the priority field has been overridden from its default value.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ],
      'changefreq' => [
        'description' => 'The average time in seconds between changes of this item.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'changecount' => [
        'description' => 'The number of times this item has been changed. Used to help calculate the next changefreq value.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'id',
      'type',
      'language',
    ],
    'indexes' => [
      'loc' => [
        'loc',
      ],
      'access_status_loc' => [
        'access',
        'status',
        'loc',
      ],
      'type_subtype' => [
        'type',
        'subtype',
      ],
    ],
  ];
  return $schema;
}