20190529075038_WpYoastDropIndexableMetaTableIfExists.php 797 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Yoast SEO Plugin File.
  4. *
  5. * @package WPSEO\Migrations
  6. */
  7. use Yoast\WP\Free\ORM\Yoast_Model;
  8. use YoastSEO_Vendor\Ruckusing_Migration_Base;
  9. /**
  10. * Class DropIndexableMetaTableIfExists
  11. */
  12. class WpYoastDropIndexableMetaTableIfExists extends Ruckusing_Migration_Base {
  13. /**
  14. * Migration up.
  15. */
  16. public function up() {
  17. $table_name = $this->get_table_name();
  18. // This can be done safely as it executes a DROP IF EXISTS.
  19. $this->drop_table( $table_name );
  20. }
  21. /**
  22. * Migration down.
  23. */
  24. public function down() {
  25. // No down required. This specific table should never exist.
  26. }
  27. /**
  28. * Retrieves the table name to use.
  29. *
  30. * @return string The table name to use.
  31. */
  32. protected function get_table_name() {
  33. return Yoast_Model::get_table_name( 'Indexable_Meta' );
  34. }
  35. }