diff --git a/xmlsitemap.install b/xmlsitemap.install index 2caaf0b..d7da6a4 100644 --- a/xmlsitemap.install +++ b/xmlsitemap.install @@ -9,6 +9,7 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AnonymousUserSession; use Drupal\Core\Url; +use Drupal\Core\Database\Database; /** * Implements hook_requirements(). @@ -168,12 +169,10 @@ function xmlsitemap_schema() { 'fields' => array( 'id' => array( 'description' => 'Primary key with type; a unique id for the item.', - 'type' => 'varchar', - 'length' => 32, + 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => '', - //'unsigned' => TRUE, - //'default' => 0, + 'default' => 0, ), 'type' => array( 'description' => 'Primary key with id; the type of item (e.g. node, user, etc.).', @@ -347,3 +346,12 @@ function xmlsitemap_uninstall() { function xmlsitemap_update_last_removed() { return 7203; } + +/** + * Change the `id` from `varchar` to `int`. + */ +function xmlsitemap_update_8003() { + $schema = Database::getConnection()->schema(); + $schema->changeField('xmlsitemap', 'id', 'id', + ['type' => 'int', 'not null' => TRUE]); +}