function flag_schema in Flag 8.4
Same name and namespace in other branches
- 6.2 flag.install \flag_schema()
- 6 flag.install \flag_schema()
- 7.3 flag.install \flag_schema()
- 7.2 flag.install \flag_schema()
Implements hook_schema().
File
- ./
flag.install, line 14 - Flag module install/schema/update hooks.
Code
function flag_schema() {
$schema = [];
$schema['flag_counts'] = [
'description' => 'The number of times an item has been flagged.',
'fields' => [
'flag_id' => [
'type' => 'varchar_ascii',
'length' => '32',
'not null' => TRUE,
],
'entity_type' => [
'description' => 'The flag type, for example "node", "comment", or "user".',
'type' => 'varchar_ascii',
'length' => EntityTypeInterface::ID_MAX_LENGTH,
'not null' => TRUE,
],
'entity_id' => [
'description' => 'The unique ID of the flagged entity, for example the uid, cid, or nid.',
'type' => 'varchar_ascii',
'length' => ConfigEntityStorage::MAX_ID_LENGTH,
'not null' => TRUE,
],
'count' => [
'description' => 'The number of times this object has been flagged for this flag.',
'type' => 'int',
'unsigned' => TRUE,
],
'last_updated' => [
'description' => 'The UNIX time stamp representing when the flag was last updated.',
'type' => 'int',
'unsigned' => TRUE,
'disp-size' => 11,
],
],
'primary key' => [
'flag_id',
'entity_id',
],
'indexes' => [
'flag_id_entity_type' => [
'flag_id',
'entity_type',
],
'entity_type_entity_id' => [
'entity_type',
'entity_id',
],
'flag_id_count' => [
'flag_id',
'count',
],
'flag_id_last_updated' => [
'flag_id',
'last_updated',
],
],
];
return $schema;
}