<?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 Version20220215140936 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql("
INSERT IGNORE INTO `std_blocks`
(`created_by`, `updated_by`, `machine_name`, `is_active`, `created_date`, `updated_date`, `name`, `settings`)
VALUES
(1, 1, 'form_text', 1, NOW(), NOW(), 'Form text', '{\"isCacheable\": false}');
");
$this->addSql("
SET @contentType_id=(SELECT id FROM std_content_types WHERE machine_name='forms');
SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_text');
INSERT IGNORE INTO `std_content_types_blocks`
(`content_type`, `block_id`)
VALUES
(@contentType_id, @block_id);
");
$this->addSql("
SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_text');
INSERT IGNORE 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_item_text', @block_id, 1, 1, 'TEXTAREA', '{\"ckeditor\": \"title\"}', 1, 1, NOW(), NOW(), 'item_text', 0);
");
$this->addSql("
SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_text');
INSERT IGNORE 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
('separator_styles', @block_id, '1', '1', 'Styles', 'SEPARATOR', '1', now(), now(), '1', NULL),
('extra_block_id', @block_id, '1', '1', 'Block ID', 'INPUT', '1', now(), now(), '2', NULL),
('extra_class', @block_id, '1', '1', 'Extra Class', 'INPUT', '1', now(), now(), '3', NULL),
('offset', @block_id, '1', '1', 'Offset', 'CHECKBOX', '1', now(), now(), '4', NULL),
('separator_spacings', @block_id, '1', '1', 'Spacings', 'SEPARATOR', '1', now(), now(), '5', NULL),
('margin', @block_id, '1', '1', 'Margin [0px 0px 0px 0px]', 'INPUT', '1', now(), now(), '6', NULL),
('padding', @block_id, '1', '1', 'Padding [0px 0px 0px 0px]', 'INPUT', '1', now(), now(), '7', NULL);
");
}
public function down(Schema $schema) : void
{
$this->addSql("
SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_text');
DELETE FROM `std_blocks_settings` where `block_id`= @block_id;
");
$this->addSql("
SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_text');
DELETE FROM `std_blocks_components` WHERE `block_id` = @block_id;
");
$this->addSql("
SET @contentType_id=(SELECT id FROM std_content_types WHERE machine_name='forms');
SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='form_text');
DELETE FROM `std_content_types_blocks` WHERE `content_type` = @contentType_id AND `block_id` = @block_id;
");
$this->addSql("
DELETE FROM `std_blocks` WHERE `machine_name` = 'form_text';
");
}
}