<?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 Version20240412231813 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql("SET @system_ct := (SELECT id FROM std_content_types WHERE machine_name = 'system');");
$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`, `layout`, `machine_name`, `include_sitemap`) VALUES (NULL, 1, 1, @system_ct, 1, NOW(), NOW(), NULL, NULL, NULL, '404 Page Not Found', NULL, '404_not_found', 0);
SET @404_not_found_page = LAST_INSERT_ID();
");
$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 (@404_not_found_page, 'pt', 1, 1, 1, NOW(), NOW(), '404 Page Not Found', '404_not_found_page', '/pt/404_not_found_page', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"404_not_found_page\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\"}, \"blockname\": \"\", \"components\": {\"title\": \"404 - Página não Encontrada\", \"title_error\": \"Erro 404\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}');
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 (@404_not_found_page, 'en', 1, 1, 1, NOW(), NOW(), '404 Page Not Found', '404_not_found_page', '/en/404_not_found_page', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"404_not_found_page\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\"}, \"blockname\": \"\", \"components\": {\"title\": \"404 - Page not Found\", \"title_error\": \"Error 404\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}');
");
$this->addSql("
INSERT INTO `std_friendly_url` (`page_id`, `url`, `relation_tree`, `relation_id`, `language_code`, `is_canonical`) VALUES (@404_not_found_page, '/pt/404_not_found_page', '[]', NULL, 'pt', 1);
INSERT INTO `std_friendly_url` (`page_id`, `url`, `relation_tree`, `relation_id`, `language_code`, `is_canonical`) VALUES (@404_not_found_page, '/en/404_not_found_page', '[]', NULL, 'en', 1);
");
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql("
DELETE FROM `std_friendly_url` WHERE `url` LIKE '%/404_not_found_page';
DELETE FROM `std_pages_content` WHERE `url` LIKE '%/404_not_found_page';
DELETE FROM `std_pages` WHERE `machine_name` = '404_not_found';
");
}
}