<?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 Version20230613084143 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='web_users_detail');");
$this->addSql("INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES
('show_erp_code', @block_id, '1', '1', 'CHECKBOX', null , 87, now(), now(), 'Mostrar código ERP?', 0)
;");
$this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
$this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Dados pessoais');");
$this->addSql("UPDATE std_pages_content
SET content =
JSON_SET(content,
concat(REPLACE(
JSON_UNQUOTE(
JSON_SEARCH(content, 'one', 'web_users_detail')
),'block',''),
'components.show_erp_code'),
'0')
WHERE page_id = @child_page;");
$this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
$this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Área reservada');");
$this->addSql("UPDATE std_pages_content
SET content =
JSON_SET(content,
concat(REPLACE(
JSON_UNQUOTE(
JSON_SEARCH(content, 'one', 'web_users_detail')
),'block',''),
'components.show_erp_code'),
'0')
WHERE page_id = @child_page;");
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='web_users_detail');");
$this->addSql("DELETE FROM `std_blocks_components` WHERE `block_id`=@block_id
AND `machine_name` IN('show_erp_code');");
$this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
$this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Dados pessoais');");
$this->addSql("UPDATE std_pages_content
SET content = JSON_REMOVE(content,
concat(
REPLACE(
JSON_UNQUOTE(
JSON_SEARCH(content, 'one', 'web_users_detail')
),'block',''),
'components.show_erp_code'))
WHERE page_id = @child_page;");
$this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
$this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Área reservada');");
$this->addSql("UPDATE std_pages_content
SET content = JSON_REMOVE(content,
concat(
REPLACE(
JSON_UNQUOTE(
JSON_SEARCH(content, 'one', 'web_users_detail')
),'block',''),
'components.show_erp_code'))
WHERE page_id = @child_page;");
}
}