migrations/Version20220214151500.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 Version20220214151500 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->addsql("SET @content_type_id = (SELECT id FROM std_content_types WHERE machine_name='pages_categories' LIMIT 1);");
  19.         $this->addSql("INSERT INTO `std_content_types_skins` (`content_type_id`, `machine_name`, `name`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) VALUES (@content_type_id, 'pages_list_60_40', 'Page List 60% 40%', 1, 1, NOW(), 1, NOW());");
  20.         $this->addSql("
  21.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='block_list');
  22.         INSERT IGNORE INTO `std_blocks_settings` (`machine_name`, `block_id`, `created_by`, `updated_by`, `name`, `setting_type`, `is_active`, `created_date`, `updated_date`, `order_value`, `settings`)
  23.         VALUES 
  24.             ('fullwidth', @block_id, 1, 1, 'Full Width', 'CHECKBOX', 1, now(), now(), 1, NULL);
  25.         ");
  26.         
  27.     }
  28.     public function down(Schema $schema) : void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addsql("SET @content_type_id = (SELECT id FROM std_content_types WHERE machine_name='pages_categories' LIMIT 1);");
  32.         $this->addSql("DELETE FROM `std_content_types_skins` WHERE `content_type_id` = @content_type_id AND `machine_name` = 'pages_list_60_40';");
  33.         $this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='block_list');");
  34.         $this->addSql("DELETE FROM std_blocks_settings WHERE `machine_name` = 'fullwidth' AND `block_id` = @block_id;");        
  35.     }
  36. }