PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
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 19.0 All 129 releases
wordpress-seo / src / config / migrations / 20211020091404_AddObjectTimestamps.php

20211020091404_AddObjectTimestamps.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at src/config/migrations/20211020091404_AddObjectTimestamps.php

89 lines 1.5 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 * AddObjectTimestamps class.
10 */
11 class AddObjectTimestamps 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 $this->add_column(
27 $this->get_table_name(),
28 'object_last_modified',
29 'datetime',
30 [
31 'null' => true,
32 'default' => null,
33 ],
34 );
35 $this->add_column(
36 $this->get_table_name(),
37 'object_published_at',
38 'datetime',
39 [
40 'null' => true,
41 'default' => null,
42 ],
43 );
44 $this->add_index(
45 $this->get_table_name(),
46 [
47 'object_published_at',
48 'is_robots_noindex',
49 'object_type',
50 'object_sub_type',
51 ],
52 [
53 'name' => 'published_sitemap_index',
54 ],
55 );
56 }
57
58 /**
59 * Migration down.
60 *
61 * @return void
62 */
63 public function down() {
64 $this->remove_column( $this->get_table_name(), 'object_last_modified' );
65 $this->remove_column( $this->get_table_name(), 'object_published_at' );
66 $this->remove_index(
67 $this->get_table_name(),
68 [
69 'object_published_at',
70 'is_robots_noindex',
71 'object_type',
72 'object_sub_type',
73 ],
74 [
75 'name' => 'published_sitemap_index',
76 ],
77 );
78 }
79
80 /**
81 * Retrieves the table name to use for storing indexables.
82 *
83 * @return string The table name to use.
84 */
85 protected function get_table_name() {
86 return Model::get_table_name( 'Indexable' );
87 }
88 }
89