migrations/Version20210409130424.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20210409130424 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B51_search_results');");
  20.         // limit
  21.         $this->addSql("
  22.             INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES 
  23.             ('limit', @block_id, '1', '1', 'INPUT', NULL, 4, now(), now(), 'Limit', 0)");
  24.         // order
  25.         $this->addSql("
  26.             INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES 
  27.             ('order', @block_id, '1', '1', 'CHECKBOX', NULL, 5, now(), now(), 'Order', 0)");
  28.         // paginate
  29.         $this->addSql("
  30.             INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES 
  31.             ('paginate', @block_id, '1', '1', 'CHECKBOX', NULL, 6, now(), now(), 'Paginate', 0)");
  32.     }
  33.     public function down(Schema $schema) : void
  34.     {
  35.         // this down() migration is auto-generated, please modify it to your needs
  36.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  37.         $this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B51_search_results');");
  38.         $this->addSql("DELETE FROM `std_blocks_components` WHERE machine_name = 'search_url' AND block_id ='@block_id';");
  39.         $this->addSql("DELETE FROM `std_blocks_components` WHERE machine_name = 'search_url' AND block_id ='@block_id';");
  40.         $this->addSql("DELETE FROM `std_blocks_components` WHERE machine_name = 'search_url' AND block_id ='@block_id';");
  41.     }
  42. }