migrations/Version20200608124523.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 Version20200608124523 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("
  19.         
  20.         INSERT INTO `std_blocks` (`created_by`, `updated_by`, `machine_name`, `created_date`, `updated_date`, `name`,`settings`) 
  21.         VALUES ('1', '1', 'form_messages', '2020-05-28 23:00:33', '2020-05-28 23:00:34', 'Form messages','{\"isFormMessages\": \"true\"}');
  22.         SET @id_block = LAST_INSERT_ID();                
  23.         INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `order_value`, `created_date`, `updated_date`, `name`) 
  24.         VALUES ('form_input_name', @id_block, '1', '1', 'INPUT', '1', '2020-06-08 15:33:53', '2020-06-08 15:33:53', 'input_name');
  25.         INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `order_value`, `created_date`, `updated_date`, `name`) 
  26.         VALUES ('form_input_label', @id_block, '1', '1', 'INPUT', '2', '2020-05-27 18:28:29', '2020-05-27 18:28:30', 'input_label');
  27.         INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `order_value`, `created_date`, `updated_date`, `name`) 
  28.         VALUES ('form_input_placeholder', @id_block, '1', '1', 'INPUT', '3', '2020-05-27 18:28:29', '2020-05-27 18:28:30', 'input_placeholder');        
  29.         
  30.         INSERT INTO `std_blocks_settings` (`machine_name`, `block_id`, `created_by`, `updated_by`, `name`, `setting_type`, `created_date`, `updated_date`, `order_value`)
  31.         VALUES ('setting_form_cols', @id_block, '1', '1', 'Form cols', 'INPUT', '2020-05-27 18:08:40', '2020-05-27 18:08:40', '1');
  32.         INSERT INTO `std_blocks_skins` (`block_id`, `machine_name`, `name`, `created_date`, `updated_date`) 
  33.         VALUES (@id_block, 'default', 'Default Messages', '2020-05-27 18:10:33', '2020-05-27 18:11:33');
  34.         SET @id_ct = (SELECT id FROM std_content_types WHERE machine_name='forms');
  35.         INSERT INTO `std_content_types_blocks` (`content_type`, `block_id`)
  36.         VALUES (@id_ct, @id_block);
  37.         ");
  38.     }
  39.     public function down(Schema $schema) : void
  40.     {
  41.         // this down() migration is auto-generated, please modify it to your needs
  42.         $this->addSql("
  43.         SET @id_block = (SELECT id FROM std_blocks WHERE machine_name='form_messages');
  44.         DELETE FROM std_content_types_blocks where block_id = @id_block;
  45.         DELETE FROM std_blocks_skins where block_id = @id_block;
  46.         DELETE FROM std_blocks_settings where block_id = @id_block;
  47.         DELETE FROM std_blocks_components where block_id = @id_block;
  48.         DELETE FROM std_blocks where id = @id_block;                
  49.         ");
  50.     }
  51. }