| 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 BreadcrumbTitleAndHierarchyReset. |
| 10 |
*/ |
| 11 |
class BreadcrumbTitleAndHierarchyReset 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_indexable_table_name(), 'breadcrumb_title', 'text', [ 'null' => true ] ); |
| 27 |
$this->query( 'DELETE FROM ' . $this->get_indexable_hierarchy_table_name() ); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Migration down. |
| 32 |
* |
| 33 |
* @return void |
| 34 |
*/ |
| 35 |
public function down() { |
| 36 |
$this->change_column( |
| 37 |
$this->get_indexable_table_name(), |
| 38 |
'breadcrumb_title', |
| 39 |
'string', |
| 40 |
[ |
| 41 |
'null' => true, |
| 42 |
'limit' => 191, |
| 43 |
], |
| 44 |
); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Retrieves the table name to use for storing indexables. |
| 49 |
* |
| 50 |
* @return string The table name to use. |
| 51 |
*/ |
| 52 |
protected function get_indexable_table_name() { |
| 53 |
return Model::get_table_name( 'Indexable' ); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Retrieves the table name to use. |
| 58 |
* |
| 59 |
* @return string The table name to use. |
| 60 |
*/ |
| 61 |
protected function get_indexable_hierarchy_table_name() { |
| 62 |
return Model::get_table_name( 'Indexable_Hierarchy' ); |
| 63 |
} |
| 64 |
} |
| 65 |
|