Elgg  Version master
20190606111641_entities_add_type_subtype_container_and_owner_indexes.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class EntitiesAddTypeSubtypeContainerAndOwnerIndexes extends AbstractMigration
6 {
28  public function change() {
29  $table = $this->table('entities');
30 
31  if (!$table->hasIndexByName('type_subtype_owner')) {
32  $table->addIndex(['type', 'subtype', 'owner_guid'], [
33  'name' => "type_subtype_owner",
34  'unique' => false,
35  'limit' => ['subtype' => 50],
36  ]);
37  }
38 
39  if (!$table->hasIndexByName('type_subtype_container')) {
40  $table->addIndex(['type', 'subtype', 'container_guid'], [
41  'name' => "type_subtype_container",
42  'unique' => false,
43  'limit' => ['subtype' => 50],
44  ]);
45  }
46 
47  $table->update();
48  }
49 }
$table
Definition: user.php:37