PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.4
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.4
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 / 20200428194858_ExpandIndexableColumnLengths.php

20200428194858_ExpandIndexableColumnLengths.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.4, at src/config/migrations/20200428194858_ExpandIndexableColumnLengths.php

85 lines 1.8 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 ExpandIndexableColumnLengths.
10 */
11 class ExpandIndexableColumnLengths 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->change_column( $this->get_table_name(), 'title', 'text', [ 'null' => true ] );
27 $this->change_column( $this->get_table_name(), 'open_graph_title', 'text', [ 'null' => true ] );
28 $this->change_column( $this->get_table_name(), 'twitter_title', 'text', [ 'null' => true ] );
29 $this->change_column( $this->get_table_name(), 'open_graph_image_source', 'text', [ 'null' => true ] );
30 $this->change_column( $this->get_table_name(), 'twitter_image_source', 'text', [ 'null' => true ] );
31 }
32
33 /**
34 * Migration down.
35 *
36 * @return void
37 */
38 public function down() {
39 $attr_limit_191 = [
40 'null' => true,
41 'limit' => 191,
42 ];
43
44 $this->change_column(
45 $this->get_table_name(),
46 'title',
47 'string',
48 $attr_limit_191,
49 );
50 $this->change_column(
51 $this->get_table_name(),
52 'opengraph_title',
53 'string',
54 $attr_limit_191,
55 );
56 $this->change_column(
57 $this->get_table_name(),
58 'twitter_title',
59 'string',
60 $attr_limit_191,
61 );
62 $this->change_column(
63 $this->get_table_name(),
64 'open_graph_image_source',
65 'string',
66 $attr_limit_191,
67 );
68 $this->change_column(
69 $this->get_table_name(),
70 'twitter_image_source',
71 'string',
72 $attr_limit_191,
73 );
74 }
75
76 /**
77 * Retrieves the table name to use for storing indexables.
78 *
79 * @return string The table name to use.
80 */
81 protected function get_table_name() {
82 return Model::get_table_name( 'Indexable' );
83 }
84 }
85