migrations/Version20211124091945.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 Version20211124091945 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 @id_ct_forms = (SELECT id FROM std_content_types WHERE machine_name='forms');
  19.         INSERT IGNORE INTO `std_content_types_components` 
  20.             (
  21.                 `content_type_id`, 
  22.                 `machine_name`, 
  23.                 `component_type`, 
  24.                 `order_value`, 
  25.                 `is_active`, 
  26.                 `created_by`, 
  27.                 `created_date`, 
  28.                 `updated_by`, 
  29.                 `updated_date`, 
  30.                 `name`, 
  31.                 `settings`
  32.             ) 
  33.         VALUES 
  34.             (
  35.                 @id_ct_forms, 
  36.                 'form_redirect', 
  37.                 'COMBO', 
  38.                 24, 
  39.                 1, 
  40.                 1, 
  41.                 NOW(), 
  42.                 1, 
  43.                 NOW(), 
  44.                 'form_redirect', 
  45.                 '{\"sql\": \"select sp.name as descricao,sp.id as codigo from std_pages sp LEFT OUTER JOIN std_content_types sct ON sp.content_type = sct.id where sct.machine_name =\'pages\' order by sp.name\", \"type\": \"dynamic\"}'
  46.             );
  47.         ");
  48.     }
  49.     public function down(Schema $schema) : void
  50.     {
  51.         // this down() migration is auto-generated, please modify it to your needs
  52.         $this->addSql("
  53.         SET @id_ct_forms = (SELECT id FROM std_content_types WHERE machine_name='forms');
  54.         delete from `std_content_types_components` where `content_type_id`=@id_ct_forms AND `machine_name`='form_redirect';
  55.         ");
  56.     }
  57. }