migrations/Version20240412231813.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240412231813 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         $this->addSql("SET @system_ct := (SELECT id FROM std_content_types WHERE machine_name = 'system');");
  18.         $this->addSql("
  19.           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);
  20.           SET @404_not_found_page = LAST_INSERT_ID();
  21.         ");
  22.         $this->addSql("
  23.           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}}}');
  24.           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}}}');
  25.         ");
  26.         $this->addSql("
  27.           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);        
  28.           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);        
  29.         ");
  30.     }
  31.     public function down(Schema $schema) : void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql("
  35.             DELETE FROM `std_friendly_url` WHERE `url` LIKE '%/404_not_found_page';
  36.             DELETE FROM `std_pages_content` WHERE `url` LIKE '%/404_not_found_page';
  37.             DELETE FROM `std_pages` WHERE `machine_name` = '404_not_found';
  38.         ");
  39.     }
  40. }