migrations/Version20210114160219.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 Version20210114160219 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         $this->addSql("SET @id_content_type = (SELECT id FROM `std_content_types` WHERE `machine_name` = 'system');");
  18.         // Create page "Login"
  19.         $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`)
  20.          VALUES (NULL, 1, 1, @id_content_type, 1, NOW(), NOW(), NULL, NOW(), NULL, 'Login');");
  21.         $this->addSql("SET @id_page = (SELECT id FROM `std_pages` WHERE `content_type` = @id_content_type AND `name`='Login');");
  22.         $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`)
  23.                 VALUES (@id_page, 'pt', 1, 1, 1, NOW(), NOW(), 'Entrar', 'entrar', '/pt/entrar', '', '', '', '', '', '', '', '', '', '', '{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"login\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\", \"disabled_block\": \"0\"}, \"blockname\": \"\", \"components\": {\"redirectto\": \"/\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}');");
  24.         //$this->addSql("INSERT INTO `std_pages_pages` (`page_id`, `relation_id`, `order_value`, `content_type`) VALUES (@id_page, 0, 1, @id_content_type);");
  25.         $this->addSql("INSERT INTO `std_friendly_url` (`page_id`, `url`, `relation_tree`, `relation_id`, `language_code`, `is_canonical`) VALUES (@id_page, '/pt/entrar', '[]', NULL, 'pt', 1);");
  26.         // Create page "Registo"
  27.         $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`)
  28.          VALUES (NULL, 1, 1, @id_content_type, 1, NOW(), NOW(), NULL, NOW(), NULL, 'Registo');");
  29.         $this->addSql("SET @id_page = (SELECT id FROM `std_pages` WHERE `content_type` = @id_content_type AND `name`='Registo');");
  30.         $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`)
  31.                 VALUES (@id_page, 'pt', 1, 1, 1, NOW(), NOW(), 'Registar', 'registar', '/pt/registar', '', '', '', '', '', '', '', '', '', '', '{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"register_web_users\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\", \"disabled_block\": \"0\"}, \"blockname\": \"\", \"components\": {\"title\": \"Registar\", \"address1\": \"1\", \"address2\": \"1\", \"activation\": \"1\", \"redirectto\": \"/\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}');");
  32.         //$this->addSql("INSERT INTO `std_pages_pages` (`page_id`, `relation_id`, `order_value`, `content_type`) VALUES (@id_page, 0, 1, @id_content_type);");
  33.         $this->addSql("INSERT INTO `std_friendly_url` (`page_id`, `url`, `relation_tree`, `relation_id`, `language_code`, `is_canonical`) VALUES (@id_page, '/pt/registar', '[]', NULL, 'pt', 1);");
  34.     }
  35.     public function down(Schema $schema) : void
  36.     {
  37.         $this->addSql("SET @id_content_type = (SELECT id FROM `std_content_types` WHERE `machine_name` = 'system');");
  38.         $this->addSql("DELETE FROM `std_friendly_url` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Login');");
  39.         $this->addSql("DELETE FROM `std_pages_pages` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Login');");
  40.         $this->addSql("DELETE FROM `std_page_web_role` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Login');");
  41.         $this->addSql("DELETE FROM `std_pages_content` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Login');");
  42.         $this->addSql("DELETE FROM `std_favorite_pages_users` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Login');");
  43.         $this->addSql("DELETE FROM `std_menus_friendly_url` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Login');");
  44.         $this->addSql("DELETE FROM `std_page_web_role` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Login');");
  45.         $this->addSql("DELETE FROM `std_pages` WHERE `content_type`=@id_content_type AND `name`='Login';");
  46.         $this->addSql("DELETE FROM `std_friendly_url` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Registo');");
  47.         $this->addSql("DELETE FROM `std_pages_pages` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Registo');");
  48.         $this->addSql("DELETE FROM `std_page_web_role` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Registo');");
  49.         $this->addSql("DELETE FROM `std_pages_content` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Registo');");
  50.         $this->addSql("DELETE FROM `std_favorite_pages_users` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Registo');");
  51.         $this->addSql("DELETE FROM `std_menus_friendly_url` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Registo');");
  52.         $this->addSql("DELETE FROM `std_page_web_role` WHERE page_id IN(SELECT id FROM std_pages WHERE `content_type`=@id_content_type AND `name`='Registo');");
  53.         $this->addSql("DELETE FROM `std_pages` WHERE `content_type`=@id_content_type AND `name`='Registo';");
  54.     }
  55. }