<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210921155827 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql("
INSERT INTO `std_blocks` (`created_by`, `updated_by`, `machine_name`, `is_active`, `created_date`, `updated_date`, `name`, `settings`) VALUES
(1, 1, 'form_radio', 1, now(), now(), 'Form radio', NULL);
SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_radio');
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_name', @block_id, 1, 1, 'INPUT', NULL, 1, 1, now(), now(), 'input_name', 0),
('form_input_label', @block_id, 1, 1, 'INPUT', NULL, 2, 1, now(), now(), 'input_label', 0),
('form_input_required_label', @block_id, 1, 1, 'INPUT', NULL, 3, 1, now(), now(), 'input_required_label', 0),
('form_radio_name', @block_id, 1, 1, 'INPUT', NULL, 4, 1, now(), now(), 'input_name', 1),
('form_radio_label', @block_id, 1, 1, 'INPUT', NULL, 5, 1, now(), now(), 'input_label', 1),
('form_checked', @block_id, 1, 1, 'CHECKBOX', NULL, 6, 1, now(), now(), 'Ligado por defeito', 1);
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
('form_required', @block_id, 1, 1, 'Required', 'CHECKBOX', 1, now(), now(), 1, NULL),
('setting_form_cols', @block_id, 1, 1, 'Form cols', 'INPUT', 1, now(), now(), 1, NULL);
SET @content_type_id=(SELECT id FROM std_content_types WHERE machine_name='forms');
INSERT INTO `std_content_types_blocks` (`content_type`, `block_id`) VALUES (@content_type_id, @block_id);
");
}
public function down(Schema $schema) : void
{
$this->addSql("
SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_radio');
DELETE FROM `std_blocks_components` WHERE block_id = @block_id;
DELETE FROM `std_blocks_settings` WHERE block_id = @block_id;
DELETE FROM `std_content_types_blocks` WHERE block_id = @block_id;
DELETE FROM `std_blocks` WHERE id = @block_id;
");
}
}