migrations/Version20210315131300.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 Version20210315131300 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.         
  19.         //Bloco
  20.         $this->addSql("
  21.         INSERT IGNORE INTO `std_blocks` (`created_by`, `updated_by`, `machine_name`, `is_active`, `created_date`, `updated_date`, `name`, `settings`) 
  22.         VALUES (1, 1, 'B07_video', 1, now(), now(), 'Video', '{\"webpackEntries\": [\"video\"]}');
  23.         ");
  24.          //Settings
  25.          $this->addSql("
  26.          SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B07_video');    
  27.              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 
  28.              ('disabled_block', @block_id, 1, 1, 'Disabled block', 'CHECKBOX', 1, now(), now(), -1, NULL),
  29.              ('separator_styles', @block_id, '1', '1', 'Styles', 'SEPARATOR', '1', now(), now(), '1', NULL),
  30.              ('extra_block_id', @block_id, '1', '1', 'Block ID', 'INPUT', '1', now(), now(), '2', NULL),
  31.              ('extra_class', @block_id, '1', '1', 'Extra Class', 'INPUT', '1', now(), now(), '3', NULL),
  32.              ('separator_spacings', @block_id, '1', '1', 'Spacings', 'SEPARATOR', '1', now(), now(), '4', NULL),
  33.              ('margin', @block_id, '1', '1', 'Margin [0px 0px 0px 0px]', 'INPUT', '1', now(), now(), '5', NULL),
  34.              ('padding', @block_id, '1', '1', 'Padding [0px 0px 0px 0px]', 'INPUT', '1', now(), now(), '6', NULL);
  35.         
  36.         ");
  37.         //Components
  38.         $this->addSql("
  39.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B07_video'); 
  40.             INSERT IGNORE INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `is_active`, `created_date`, `updated_date`, `name`, `is_repeatable`) 
  41.             VALUES 
  42.                 ('video_youtubeid', @block_id, 1, 1, 'INPUT', NULL, 1, 1, now(), now(), 'Youtube ID', 0),
  43.                 ('video', @block_id, 1, 1, 'IMAGE', NULL, 2, 1, now(), now(), 'Video', 0),
  44.                 ('video_autoplay', @block_id, 1, 1, 'CHECKBOX', NULL, 3, 1, now(), now(), 'Autoplay', 0),
  45.                 ('video_thumb', @block_id, 1, 1, 'IMAGE', NULL, 4, 1, now(), now(), 'Video Cover 1920x1080', 0);
  46.         ");
  47.         //Skins
  48.         $this->addSql("
  49.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B07_video'); 
  50.             INSERT IGNORE INTO `std_blocks_skins` (`block_id`, `machine_name`, `name`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) 
  51.             VALUES (@block_id, 'fullscreen', 'Fullscreen', 1, 1, now(), 1, now());
  52.           
  53.             
  54.         ");
  55.     }
  56.     public function down(Schema $schema) : void
  57.     {
  58.         // this down() migration is auto-generated, please modify it to your needs
  59.         $this->addSql("
  60.             SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B07_video'); 
  61.               DELETE FROM `std_blocks_skins` where machine_name IN ('fullscreen') and `block_id`= @block_id;
  62.               DELETE FROM `std_blocks_components` where machine_name IN ('video_youtubeid','video','video_autoplay','video_thumb') and `block_id`= @block_id;
  63.               DELETE FROM `std_blocks_settings` where machine_name IN ('separator_styles','extra_block_id','extra_class','separator_spacings','margin','padding') and `block_id`= @block_id;
  64.               DELETE FROM `std_blocks` where machine_name = 'B07_video';
  65.         ");
  66.     }
  67. }