migrations/Version20220121120036.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 Version20220121120036 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         /*******************
  18.          * BLOCK - IMAGE B04
  19.          */
  20.         //Bloco
  21.         $this->addSql("INSERT IGNORE INTO `std_blocks` (`created_by`, `updated_by`, `machine_name`, `created_date`, `updated_date`, `name`) VALUES ('1', '1', 'B04_image', now(), now(), 'Image');");
  22.         //Settings
  23.         $this->addSql("
  24.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B04_image');    
  25.             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`) VALUES 
  26.             ('disabled_block', @block_id, 1, 1, 'Disabled block', 'CHECKBOX', 1, now(), now(), -1, NULL),
  27.             ('fullwidth', @block_id, 1, 1, 'Full Width', 'CHECKBOX', 1, now(), now(), 1, NULL),
  28.             ('separador_styles', @block_id, '1', '1', 'Styles', 'SEPARADOR', '1', now(), now(), '1', NULL),
  29.             ('extra_block_id', @block_id, '1', '1', 'Block ID', 'INPUT', '1', now(), now(), '2', NULL),
  30.             ('extra_class', @block_id, '1', '1', 'Extra Class', 'INPUT', '1', now(), now(), '3', NULL),
  31.             ('separador_spacings', @block_id, '1', '1', 'Spacings (top, right, bottom, left)', 'SEPARADOR', '1', now(), now(), '4', NULL),
  32.             ('margin', @block_id, '1', '1', 'Margin [0px 0px 0px 0px]', 'INPUT', '1', now(), now(), '5', NULL),
  33.             ('padding', @block_id, '1', '1', 'Padding [0px 0px 0px 0px]', 'INPUT', '1', now(), now(), '6', NULL);
  34.         ");
  35.         //Components
  36.         $this->addSql("
  37.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B04_image');
  38.             INSERT IGNORE 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 
  39.             ('image', @block_id, '1', '1', 'IMAGE', NULL, '1', now(), now(), 'Image', '0'),
  40.             ('type', @block_id, '1', '1', 'COMBO', '{\"data\": [{\"Small\": \"small\"}, {\"Medium\": \"medium\"}, {\"Full\": \"full\"}], \"type\": \"static\", \"default\": \"\"}', '4', now(), now(), 'Type', '0'),
  41.             ('align', @block_id, 1, 1, 'COMBO', '{\"data\": [{\"Center\": \"text-center\"}, {\"Right\": \"text-right\"}], \"type\": \"static\"}', 10, now(), now(), 'Align', '0');
  42.         ");
  43.     }
  44.     public function down(Schema $schema) : void
  45.     {
  46.         $this->addSql("
  47.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B04_image'); 
  48.             DELETE FROM `std_blocks_components` WHERE block_id = @block_id;
  49.             DELETE FROM `std_blocks_settings` WHERE block_id = @block_id;
  50.             DELETE FROM `std_blocks` where id = @block_id;
  51.         ");  
  52.     }
  53. }