Elgg  Version master
20200303122949_add_time_created_index_to_annotations_table.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class AddTimeCreatedIndexToAnnotationsTable extends AbstractMigration {
6 
10  public function change() {
11  if (!$this->hasTable('annotations')) {
12  return;
13  }
14 
15  $table = $this->table('annotations');
16  if ($table->hasIndexByName('time_created')) {
17  return;
18  }
19 
20  $table->addIndex(['time_created'], [
21  'name' => 'time_created',
22  'unique' => false,
23  ]);
24 
25  $table->save();
26  }
27 }
$table
Definition: user.php:37
change()
Adds an index to the annotations table for the time_created column.