PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.6
28.6 28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 All 130 releases
wordpress-seo / src / config / migrations / 20260105111111_AddSeoLinksIndex.php

20260105111111_AddSeoLinksIndex.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.6, at src/config/migrations/20260105111111_AddSeoLinksIndex.php

78 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Config\Migrations;
4
5 use Yoast\WP\Lib\Migrations\Migration;
6 use Yoast\WP\Lib\Model;
7
8 /**
9 * AddSeoLinksIndex class.
10 */
11 class AddSeoLinksIndex extends Migration {
12
13 /**
14 * The plugin this migration belongs to.
15 *
16 * @var string
17 */
18 public static $plugin = 'free';
19
20 /**
21 * Migration up.
22 *
23 * @return void
24 */
25 public function up() {
26 $table_name = $this->get_table_name();
27
28 $this->add_index(
29 $table_name,
30 'url',
31 [
32 'name' => 'url_index',
33 ],
34 );
35
36 $this->add_index(
37 $table_name,
38 'target_indexable_id',
39 [
40 'name' => 'target_indexable_id_index',
41 ],
42 );
43 }
44
45 /**
46 * Migration down.
47 *
48 * @return void
49 */
50 public function down() {
51 $table_name = $this->get_table_name();
52
53 $this->remove_index(
54 $table_name,
55 'url',
56 [
57 'name' => 'url_index',
58 ],
59 );
60 $this->remove_index(
61 $table_name,
62 'target_indexable_id',
63 [
64 'name' => 'target_indexable_id_index',
65 ],
66 );
67 }
68
69 /**
70 * Retrieves the table name to use.
71 *
72 * @return string The table name to use.
73 */
74 protected function get_table_name() {
75 return Model::get_table_name( 'SEO_Links' );
76 }
77 }
78