View source
<?php
use Drupal\Core\Database\Database;
function simplifying_schema() {
$schema['simplifying_entity_unread'] = [
'description' => 'new unread entitis.',
'fields' => [
'id' => [
'description' => 'The primary identifier.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'entity_type' => [
'description' => 'Entity type',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'bundle' => [
'description' => 'Bundle',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'entity_id' => [
'description' => 'Entity ID',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => 0,
],
],
'indexes' => [
'id' => [
'id',
],
'entity_type' => [
'entity_type',
],
'bundle' => [
'bundle',
],
'entity_id' => [
'entity_id',
],
],
'primary key' => [
'id',
],
];
return $schema;
}
function simplifying_update_8001() {
$schema = Database::getConnection()
->schema();
if (!$schema
->tableExists('simplifying_entity_unread')) {
$specs = simplifying_schema();
$schema
->createTable('simplifying_entity_unread', $specs['simplifying_entity_unread']);
}
}