migrations/Version20210504123028.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 Version20210504123028 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='form_file');
  19.             INSERT 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`) VALUES 
  20.                 ('form_input_placeholder', @block_id, 1, 1, 'INPUT', NULL, '3', 1,  now(),  now(), 'Placeholder', 0);
  21.             UPDATE `std_blocks` SET `settings`='{\"webpackEntries\": [\"fileform\"]}' WHERE `id`=@block_id; 
  22.         ");
  23.         $this->addSql("UPDATE `std_blocks_settings` SET `name`='Required' WHERE  `machine_name`='form_required';");
  24.         $this->addSql("
  25.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_checkbox');
  26.             INSERT 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`) VALUES 
  27.                 ('form_input_required_label', @block_id, 1, 1, 'INPUT', NULL, '5', 1,  now(),  now(), 'input_required_label', 0),
  28.                 ('form_checked', @block_id, 1, 1, 'CHECKBOX', NULL, '7', 1, now(), now(), 'Ligado por defeito', 0);
  29.             INSERT 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 
  30.                 ('form_required', @block_id, '1', '1', 'Required', 'CHECKBOX', '1', now(), now(), '1', NULL);
  31.         ");
  32.         
  33.         $this->addSql("
  34.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_select');
  35.             DELETE FROM `std_blocks_components` WHERE  `block_id`=@block_id AND `machine_name`='form_input_children';
  36.             DELETE FROM `std_blocks_components` WHERE  `block_id`=@block_id AND `machine_name`='form_select_parent_relation';
  37.         ");
  38.         $this->addSql("UPDATE `std_blocks_components` SET `is_active`='0' WHERE  `block_id`=17 AND `machine_name`='form_input_minlength_label';");
  39.        
  40.     }
  41.     public function down(Schema $schema) : void
  42.     {
  43.         $this->addSql("
  44.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_file');
  45.             UPDATE `std_blocks` SET `settings`=NULL WHERE  `id`=@block_id; 
  46.             DELETE FROM `std_blocks_components` WHERE  `block_id`=@block_id AND `machine_name`='form_input_placeholder';
  47.         ");
  48.         
  49.         $this->addSql("
  50.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_select');
  51.             INSERT 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`) VALUES ('form_input_children', @block_id, 1, 1, 'INPUT', NULL, 5, 1, '2019-08-21 10:20:41', '2019-08-21 10:20:41', 'input_children', 0);
  52.             INSERT 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`) VALUES ('form_select_parent_relation', @block_id, 1, 1, 'INPUT', NULL, 10, 1, '2019-08-21 10:22:55', '2019-08-21 10:22:56', 'select_parent_relation', 1);
  53.         ");
  54.         $this->addSql("UPDATE `std_blocks_components` SET `is_active`='1' WHERE  `block_id`=17 AND `machine_name`='form_input_minlength_label';");
  55.         $this->addSql("
  56.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_checkbox');
  57.             DELETE FROM `std_blocks_components` WHERE  `block_id`=@block_id AND `machine_name`='form_input_required_label';
  58.             DELETE FROM `std_blocks_components` WHERE  `block_id`=@block_id AND `machine_name`='form_checked';
  59.             DELETE FROM `std_blocks_settings` WHERE  `block_id`=@block_id AND `machine_name`='form_checked';
  60.         ");
  61.     }
  62. }