Elgg  Version 7.1
20260910072856_add_metadata_entity_guid_name_index.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 use Phinx\Db\Adapter\MysqlAdapter;
6 use Phinx\Migration\AbstractMigration;
7 
8 final class AddMetadataEntityGuidNameIndex extends AbstractMigration {
9 
15  public function change(): void {
16  if (!$this->hasTable('metadata')) {
17  return;
18  }
19 
20  $table = $this->table('metadata');
21  if ($table->hasIndexByName('entity_guid_name')) {
22  return;
23  }
24 
25  $table->addIndex(['entity_guid', 'name'], [
26  'name' => 'entity_guid_name',
27  'unique' => false,
28  'limit' => [
29  'name' => MysqlAdapter::INT_TINY,
30  ],
31  ]);
32 
33  $table->save();
34  }
35 }
change()
Add an index to the metadata table for the columns ('entity_guid', 'name')
$table
Definition: database.php:52
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
Definition: robots.php:10