<?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 Version20210212145454 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql("SET @id_content_type = (SELECT id FROM std_content_types WHERE machine_name='menus');");
$this->addSql("INSERT INTO `std_pages` (`template_id`, `created_by`, `updated_by`, `content_type`, `is_active`, `created_date`, `updated_date`, `order_value`, `publish_date`, `expire_date`, `name`) VALUES (NULL, 1, 1, @id_content_type, 1, NOW(), NOW(), NULL, NULL, NULL, 'Sair');");
$this->addSql("SET @id_logout_page = (SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND name='Sair');");
$this->addSql("INSERT INTO `std_pages_content` (`page_id`, `language_code`, `created_by`, `updated_by`, `is_active`, `created_date`, `updated_date`, `title`, `url`, `canonical_url`, `meta_title`, `meta_keywords`, `meta_description`, `og_title`, `og_image`, `og_description`, `og_url`, `scripts_head`, `scripts_body`, `scripts_footer`, `content`) VALUES (@id_logout_page, 'pt', 1, 1, 1, NOW(), NOW(), 'Sair', '/logout', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '{\"link\": \"/logout\", \"target\": \"_self\"}');");
$this->addSql("SET @menu_content_type = (SELECT id FROM std_content_types WHERE machine_name='menus');");
$this->addSql("SET @menu_page = (SELECT id FROM std_pages WHERE `content_type`=@menu_content_type AND name='Menu área reservada');");
$this->addSql("SET @menu_page_relation = (SELECT id FROM std_pages_pages WHERE `page_id`=@menu_page);");
$this->addSql("INSERT INTO `std_pages_pages` (`page_id`, `relation_id`, `order_value`, `content_type`) VALUES (@id_logout_page, @menu_page_relation, 9999, @id_content_type);");
}
public function down(Schema $schema) : void
{
$this->addSql("SET @id_content_type = (SELECT id FROM std_content_types WHERE machine_name='menus');");
$this->addSql("SET @id_logout_page = (SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND name='Sair');");
$this->addSql("DELETE FROM `std_pages_pages` WHERE `page_id`=@id_logout_page;");
$this->addSql("DELETE FROM `std_pages_content` WHERE `page_id`=@id_logout_page;");
$this->addSql("DELETE FROM `std_pages` WHERE id=@id_logout_page;");
// $this->addSql("DELETE FROM `std_content_types_skins` WHERE `content_type_id`=@id_content_type AND `machine_name`='private_area_menu';");
}
}