wordpress-seo
/
src
/
config
/
migrations
/
20190529075038_WpYoastDropIndexableMetaTableIfExists.php
20190529075038_WpYoastDropIndexableMetaTableIfExists.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.6, at src/config/migrations/20190529075038_WpYoastDropIndexableMetaTableIfExists.php
| 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 WpYoastDropIndexableMetaTableIfExists. |
| 10 | */ |
| 11 | class WpYoastDropIndexableMetaTableIfExists 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 | // This can be done safely as it executes a DROP IF EXISTS. |
| 29 | $this->drop_table( $table_name ); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Migration down. |
| 34 | * |
| 35 | * @return void |
| 36 | */ |
| 37 | public function down() { |
| 38 | // No down required. This specific table should never exist. |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Retrieves the table name to use. |
| 43 | * |
| 44 | * @return string The table name to use. |
| 45 | */ |
| 46 | protected function get_table_name() { |
| 47 | return Model::get_table_name( 'Indexable_Meta' ); |
| 48 | } |
| 49 | } |
| 50 |