Elgg  Version 5.1
20200331083912_add_entity_guid_name_index_to_annotations.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class AddEntityGuidNameIndexToAnnotations extends AbstractMigration {
7 
11  public function change() {
12  if (!$this->hasTable('annotations')) {
13  return;
14  }
15 
16  $table = $this->table('annotations');
17  if ($table->hasIndexByName('entity_guid_name')) {
18  return;
19  }
20 
21  $table->addIndex(['entity_guid', 'name'], [
22  'name' => 'entity_guid_name',
23  'unique' => false,
24  'limit' => [
25  'name' => MysqlAdapter::INT_TINY,
26  ],
27  ]);
28 
29  $table->save();
30  }
31 }
change()
Add an index to the annotations table for the columns entity_guid and name.
$table
Definition: user.php:37