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