migrations/Version20200529210244.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 Version20200529210244 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_domains` (`updated_by`, `language_code`, `created_by`, `machine_name`, `description`, `created_date`, `updated_date`) 
  20.         VALUES ('1', 'pt', '1', 'form_status', 'Estados de formulários', '2020-05-28 18:59:33', '2020-05-28 18:59:34');
  21.         SET @id_domain = LAST_INSERT_ID();
  22.         INSERT INTO `std_domains_values` (`updated_by`, `language_code`, `created_by`, `domain_id`, `machine_name`, `description`, `created_date`, `updated_date`) 
  23.         VALUES ('1', 'pt', '1', @id_domain, 'default', 'Criado', '2020-05-28 19:00:49', '2020-05-28 19:00:49');
  24.         
  25.         INSERT INTO `std_blocks` (`created_by`, `updated_by`, `machine_name`, `created_date`, `updated_date`, `name`,`settings`) 
  26.         VALUES ('1', '1', 'form_status', '2020-05-28 23:00:33', '2020-05-28 23:00:34', 'Form estado','{\"isFormStatus\": \"true\"}');
  27.         SET @id_block = LAST_INSERT_ID();                
  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_name', @id_block, '1', '1', 'INPUT', '1', '2020-05-27 18:06:39', '2020-05-27 18:06:40', 'input_name');
  30.         INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `order_value`, `created_date`, `updated_date`, `name`) 
  31.         VALUES ('form_input_label', @id_block, '1', '1', 'INPUT', '2', '2020-05-27 18:28:29', '2020-05-27 18:28:30', 'input_label');
  32.         INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `order_value`, `created_date`, `updated_date`, `name`) 
  33.         VALUES ('form_input_placeholder', @id_block, '1', '1', 'INPUT', '3', '2020-05-27 18:28:29', '2020-05-27 18:28:30', 'input_placeholder');
  34.         INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `order_value`, `created_date`, `updated_date`, `name`) 
  35.         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');
  36.             
  37.         INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `order_value`, `created_date`, `updated_date`, `name`,`settings`) 
  38.         VALUES ('form_select_default', @id_block, '1', '1', 'COMBO', '5', '2020-05-27 18:28:29', '2020-05-27 18:28:30', 'default_status','{\"sql\": \"SELECT dv.machine_name AS codigo, dv.description AS descricao FROM std_domains_values dv INNER JOIN std_domains d ON dv.domain_id=d.id WHERE d.machine_name=''form_status'' AND d.language_code=(SELECT language_code FROM std_languages WHERE is_active=1 AND is_public=1 LIMIT 1) AND dv.language_code=(SELECT language_code FROM std_languages WHERE is_active=1 AND is_public=1 LIMIT 1) AND dv.is_active=1 AND d.is_active=1 ORDER BY dv.description \", \"type\": \"dynamic\", \"isMultiple\": \"false\"}');
  39.         INSERT INTO `std_blocks_settings` (`machine_name`, `block_id`, `created_by`, `updated_by`, `name`, `setting_type`, `created_date`, `updated_date`, `order_value`) 
  40.         VALUES ('form_required', @id_block, '1', '1', 'Form status required', 'CHECKBOX', '2020-05-27 18:08:16', '2020-05-27 18:08:17', '1');
  41.         
  42.         INSERT INTO `std_blocks_settings` (`machine_name`, `block_id`, `created_by`, `updated_by`, `name`, `setting_type`, `created_date`, `updated_date`, `order_value`)
  43.         VALUES ('setting_form_cols', @id_block, '1', '1', 'Form cols', 'INPUT', '2020-05-27 18:08:40', '2020-05-27 18:08:40', '2');
  44.         INSERT INTO `std_blocks_skins` (`block_id`, `machine_name`, `name`, `created_date`, `updated_date`) 
  45.         VALUES (@id_block, 'default', 'Default Form status', '2020-05-27 18:10:33', '2020-05-27 18:11:33');
  46.         SET @id_ct = (SELECT id FROM std_content_types WHERE machine_name='forms');
  47.         INSERT INTO `std_content_types_blocks` (`content_type`, `block_id`)
  48.         VALUES (@id_ct, @id_block);
  49.     
  50.         ");
  51.     }
  52.     public function down(Schema $schema) : void
  53.     {
  54.         // this down() migration is auto-generated, please modify it to your needs
  55.         $this->addSql("
  56.         SET @id_block = (SELECT id FROM std_blocks WHERE machine_name='form_status');
  57.         DELETE FROM std_content_types_blocks where block_id = @id_block;
  58.         DELETE FROM std_blocks_skins where block_id = @id_block;
  59.         DELETE FROM std_blocks_settings where block_id = @id_block;
  60.         DELETE FROM std_blocks_components where block_id = @id_block;
  61.         DELETE FROM std_blocks where id = @id_block;
  62.         SET @id_domain = (select id from std_domains where machine_name='form_status' and language_code='pt');
  63.         DELETE FROM std_domains_values WHERE domain_id=@id_domain;
  64.         DELETE FROM std_domains WHERE id=@id_domain;
  65.         ");
  66.     }
  67. }