forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
62 lines
1.5 KiB
Twig
62 lines
1.5 KiB
Twig
/**
|
|
* Implements hook_schema().
|
|
*/
|
|
function {{ machine_name }}_schema() {
|
|
$schema['users_data'] = [
|
|
'description' => 'Stores module data as key/value pairs per user.',
|
|
'fields' => [
|
|
'uid' => [
|
|
'description' => 'The {users}.uid this record affects.',
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
],
|
|
'module' => [
|
|
'description' => 'The name of the module declaring the variable.',
|
|
'type' => 'varchar_ascii',
|
|
'length' => DRUPAL_EXTENSION_NAME_MAX_LENGTH,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
],
|
|
'name' => [
|
|
'description' => 'The identifier of the data.',
|
|
'type' => 'varchar_ascii',
|
|
'length' => 128,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
],
|
|
'value' => [
|
|
'description' => 'The value.',
|
|
'type' => 'blob',
|
|
'not null' => FALSE,
|
|
'size' => 'big',
|
|
],
|
|
'serialized' => [
|
|
'description' => 'Whether value is serialized.',
|
|
'type' => 'int',
|
|
'size' => 'tiny',
|
|
'unsigned' => TRUE,
|
|
'default' => 0,
|
|
],
|
|
],
|
|
'primary key' => ['uid', 'module', 'name'],
|
|
'indexes' => [
|
|
'module' => ['module'],
|
|
'name' => ['name'],
|
|
],
|
|
// For documentation purposes only; foreign keys are not created in the
|
|
// database.
|
|
'foreign keys' => [
|
|
'data_user' => [
|
|
'table' => 'users',
|
|
'columns' => [
|
|
'uid' => 'uid',
|
|
],
|
|
],
|
|
],
|
|
];
|
|
|
|
return $schema;
|
|
}
|