migrations/Version20220120113620.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 Version20220120113620 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         $this->addSql("
  18.         INSERT INTO `std_blocks` (`created_by`, `updated_by`, `machine_name`, `is_active`, `created_date`, `updated_date`, `name`, `settings`) 
  19.         VALUES (1, 1, 'B15_cards_list', 1, now(), now(), 'Cards List', NULL);
  20.         ");
  21.         //Settings
  22.          $this->addSql("
  23.          SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B15_cards_list');    
  24.              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 
  25.              ('disabled_block', @block_id, 1, 1, 'Disabled block', 'CHECKBOX', 1, now(), now(), -1, NULL),
  26.              ('offset', @block_id, 1, 1, 'Offset', 'CHECKBOX', 1, now(), now(), 0, NULL),
  27.              ('column', @block_id, 1, 1, 'NÂș of Columns', 'COMBO', 1, now(), now(), 1, '{\"data\": [{\"One\": \"1\"}, {\"Two\": \"2\"}, {\"Three\": \"3\"}, {\"Four\": \"4\"}, {\"Five\": \"5\"}], \"type\": \"static\", \"default\": \"3\"}'),
  28.              ('separator_styles', @block_id, '1', '1', 'Styles', 'SEPARATOR', '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.              ('align', @block_id, '1', '1', 'Align', 'COMBO', '1', now(), now(), '4', '{\"data\": [{\"End\": \" justify-content-end\"}, {\"Center\": \" justify-content-center\"}, {\"Between\": \" justify-content-between\"}, {\"Around\": \" justify-content-around\"}], \"type\": \"static\"}'),
  32.              ('align_content', @block_id, '1', '1', 'Align Content', 'COMBO', '1', now(), now(), '4', '{\"data\": [{\"Center\": \" text-center\"}, {\"Right\": \" text-right\"}], \"type\": \"static\"}'),
  33.              ('separator_spacings', @block_id, '1', '1', 'Spacings', 'SEPARATOR', '1', now(), now(), '4', NULL),
  34.              ('margin', @block_id, '1', '1', 'Margin [0px 0px 0px 0px]', 'INPUT', '1', now(), now(), '5', NULL),
  35.              ('padding', @block_id, '1', '1', 'Padding [0px 0px 0px 0px]', 'INPUT', '1', now(), now(), '6', NULL);
  36.         ");
  37.         //Components
  38.         $this->addSql("
  39.         SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B15_cards_list');
  40.         INSERT 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 
  41.             ('image', @block_id, '1', '1', 'IMAGE', NULL, '2', now(), now(), 'Image', '1'),
  42.             ('label', @block_id, '1', '1', 'INPUT', NULL, '3', now(), now(), 'Label', '1'),
  43.             ('short_text', @block_id, '1', '1', 'TEXTAREA', '{\"ckeditor\": \"basic\"}', '4', now(), now(), 'Text', '1'),
  44.             ('link', @block_id, '1', '1', 'COMBO_PAGES', '{\"content_type\": \"all\"}', '5', now(), now(), 'Link', '1'),
  45.             ('url_ext', @block_id, '1', '1', 'INPUT', NULL, '5', now(), now(), 'URL ext', '1'),
  46.             ('btn_label', @block_id , '1', '1', 'INPUT', NULL, 5, now(), now(), 'BT Label', 1);
  47.         ");
  48.     }
  49.     public function down(Schema $schema) : void
  50.     {
  51.         $this->addSql("
  52.             SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='B15_cards_list'); 
  53.                 DELETE FROM `std_blocks_components` WHERE block_id = @block_id;
  54.                 DELETE FROM `std_blocks_settings` WHERE block_id = @block_id;
  55.                 DELETE FROM `std_blocks` where id = @block_id;
  56.             ");
  57.     }
  58. }