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