migrations/Version20210504152512.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 Version20210504152512 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         $this->addSql("
  18.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B51_search_results'); 
  19.             DELETE FROM `std_blocks_components` WHERE machine_name = 'results_placeholder' AND block_id =@block_id;
  20.             DELETE FROM `std_blocks_components` WHERE machine_name = 'results_title' AND block_id =@block_id;
  21.         ");
  22.         $arrayJsonContent '{"fields":{
  23.             "1":{
  24.                 "skin":"",
  25.                 "block":"B51_search_results",
  26.                 "isMaster":"0",
  27.                 "settings":{},
  28.                 "blockname":"",
  29.                 "components":{
  30.                     "results_label":"A mostrar correspondĂȘncias para "
  31.                 },
  32.                 "repeatable":[],
  33.                 "templatesBlocksId":"0"
  34.                 }                        
  35.             }
  36.             }';
  37.         $this->addSql("UPDATE `std_pages_content` SET `content`='".str_replace(["\n","\r","\t"],"",$arrayJsonContent)."' WHERE  `url`='pesquisa' AND `language_code`='pt';");
  38.     }
  39.     public function down(Schema $schema) : void
  40.     {
  41.         // this down() migration is auto-generated, please modify it to your needs
  42.         $this->addSql("
  43.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B51_search_results');
  44.         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 
  45.             ('results_placeholder', @block_id, '1', '1', 'INPUT', NULL, 1, now(), now(), 'Results Placeholder', 0),
  46.             ('results_title', @block_id, '1', '1', 'INPUT', NULL, 1, now(), now(), 'Results Title', 0);
  47.         ");
  48.     }
  49. }