<?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 Version20210212110702 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql("UPDATE std_blocks SET settings='{\"isWebUsersLogin\":true}' WHERE machine_name='login';");
$this->addSql("SET @id_block = (SELECT id FROM std_blocks WHERE machine_name='login' LIMIT 1);");
$this->addSql("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 ('force_redirect_when_logged', @id_block, 1, 1, 'CHECKBOX', NULL, 1, 1, NOW(), NOW(), 'Force redirect when logged in', 0);");
$this->addSql("SET @id_content_type = (SELECT id FROM `std_content_types` WHERE `machine_name`='system');");
$this->addSql("SET @id_login_page = (SELECT id FROM `std_pages` WHERE `name`='Login' AND `content_type`=@id_content_type);");
$this->addSql("UPDATE `std_pages_content` SET content='{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"login\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\", \"disabled_block\": \"0\"}, \"blockname\": \"\", \"components\": {\"redirectto\": \"/pt/area-reservada\", \"force_redirect_when_logged\": \"1\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}' WHERE `page_id`=@id_login_page AND `language_code`='pt'");
}
public function down(Schema $schema) : void
{
$this->addSql("UPDATE std_blocks SET settings=NULL WHERE machine_name='login';");
$this->addSql("SET @id_block = (SELECT id FROM std_blocks WHERE machine_name='login' LIMIT 1);");
$this->addSql("DELETE FROM `std_blocks_components` WHERE `block_id`=@id_block AND `machine_name`='force_redirect_when_logged';");
$this->addSql("SET @id_content_type = (SELECT id FROM `std_content_types` WHERE `machine_name`='system');");
$this->addSql("SET @id_login_page = (SELECT id FROM `std_pages` WHERE `name`='Login' AND `content_type`=@id_content_type);");
$this->addSql("UPDATE `std_pages_content` SET content='{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"login\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\", \"disabled_block\": \"0\"}, \"blockname\": \"\", \"components\": {\"redirectto\": \"/\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}' WHERE `page_id`=@id_login_page AND `language_code`='pt'");
}
}