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 / 20191011111109_WpYoastIndexableHierarchy.php

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

84 lines 1.6 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 * Class WpYoastIndexableHierarchy.
10 */
11 class WpYoastIndexableHierarchy 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 $indexable_table = $this->create_table( $table_name, [ 'id' => false ] );
29
30 $indexable_table->column(
31 'indexable_id',
32 'integer',
33 [
34 'primary_key' => true,
35 'unsigned' => true,
36 'null' => true,
37 'limit' => 11,
38 ],
39 );
40 $indexable_table->column(
41 'ancestor_id',
42 'integer',
43 [
44 'primary_key' => true,
45 'unsigned' => true,
46 'null' => true,
47 'limit' => 11,
48 ],
49 );
50 $indexable_table->column(
51 'depth',
52 'integer',
53 [
54 'unsigned' => true,
55 'null' => true,
56 'limit' => 11,
57 ],
58 );
59 $indexable_table->finish();
60
61 $this->add_index( $table_name, 'indexable_id', [ 'name' => 'indexable_id' ] );
62 $this->add_index( $table_name, 'ancestor_id', [ 'name' => 'ancestor_id' ] );
63 $this->add_index( $table_name, 'depth', [ 'name' => 'depth' ] );
64 }
65
66 /**
67 * Migration up.
68 *
69 * @return void
70 */
71 public function down() {
72 $this->drop_table( $this->get_table_name() );
73 }
74
75 /**
76 * Retrieves the table name to use.
77 *
78 * @return string The table name to use.
79 */
80 protected function get_table_name() {
81 return Model::get_table_name( 'Indexable_Hierarchy' );
82 }
83 }
84