migrations/Version20210812164226.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 Version20210812164226 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         $this->addSql("
  18.             INSERT IGNORE INTO `std_config` (`machine_name`, `created_by`, `updated_by`, `description_machine_name`, `details_machine_name`, `parent_name`, `variable_type`, `order_value`, `is_hidden`, `created_date`, `updated_date`, `label`, `language_code`)
  19.             VALUES 
  20.                 ('logoemail', '1', '1', 'logoemail', 'logoemail', 'Theme', 'IMAGE', '5', '0', now(), now(), 'Logo Email', '')
  21.         ");
  22.         $this->addSql("
  23.             INSERT IGNORE INTO `std_config` (`machine_name`, `created_by`, `updated_by`, `description_machine_name`, `details_machine_name`, `parent_name`, `variable_type`, `order_value`, `is_hidden`, `created_date`, `updated_date`, `label`, `language_code`)
  24.             VALUES 
  25.                 ('favicon', '1', '1', 'favicon', 'favicon', 'Theme', 'IMAGE', '6', '0', now(), now(), 'Favicon 192x192', '')
  26.         ");
  27.         
  28.         $this->addSql("
  29.             INSERT IGNORE INTO `std_config` (`machine_name`, `created_by`, `updated_by`, `value`, `description_machine_name`, `details_machine_name`, `parent_name`, `variable_type`, `order_value`, `is_hidden`, `label`, `language_code`) VALUES 
  30.                 ('facebook_url', '1', '1', '', 'facebook_url', 'redes_sociais', 'Redes Sociais', 'INPUT', '1', '0', 'URL Facebook',''),
  31.                 ('instagram_url', '1', '1', '', 'instagram_url', 'redes_sociais', 'Redes Sociais', 'INPUT', '2', '0', 'URL Instagram',''),
  32.                 ('linkedin_url', '1', '1', '', 'linkedin_url', 'redes_sociais', 'Redes Sociais', 'INPUT', '3', '0', 'URL Linkedin',''),
  33.                 ('youtube_url', '1', '1', '', 'youtube_url', 'redes_sociais', 'Redes Sociais', 'INPUT', '4', '0', 'URL Youtube',''),
  34.                 ('twitter_url', '1', '1', '', 'twitter_url', 'redes_sociais', 'Redes Sociais', 'INPUT', '5', '0', 'URL Twitter',''), 
  35.                 ('footer_text', '1', '1', '', 'footer_text', 'footer', 'Footer', 'TEXTAREA', '3', '0', 'Footer text','pt'),
  36.                 ('footer_text', '1', '1', '', 'footer_text', 'footer', 'Footer', 'TEXTAREA', '3', '0', 'Footer text','en'),
  37.                 ('footer_text2', '1', '1', '', 'footer_text2', 'footer', 'Footer', 'TEXTAREA', '3', '0', 'Footer text 2','pt'),
  38.                 ('footer_text2', '1', '1', '', 'footer_text2', 'footer', 'Footer', 'TEXTAREA', '3', '0', 'Footer text 2','en');
  39.         ");
  40.         
  41.         $this->addSql("
  42.             INSERT INTO `std_config` (`machine_name`, `created_by`, `updated_by`, `value`, `description_machine_name`, `details_machine_name`, `parent_name`, `variable_type`, `order_value`, `is_hidden`, `label`, `content`, `language_code`) VALUES 
  43.                 ('header_style', '1', '1', 'header_1', 'header_style', 'header_style', 'Theme', 'SELECT', '10', '0', 'Header Style','{\"query\": \"SELECT \'Header 1\' AS label,\'header_1\' AS `id` UNION SELECT \'Header 2\' AS label,\'header_2\' AS `id` UNION SELECT \'Header 3\' AS label,\'header_3\' AS `id` UNION SELECT \'Header Custom\' AS label,\'header_custom\' AS `id`\"}',''),
  44.                 ('footer_style', '1', '1', 'footer_1', 'footer_style', 'footer_style', 'Theme', 'SELECT', '11', '0', 'Footer Style','{\"query\": \"SELECT \'Footer 1\' AS label,\'footer_1\' AS `id` UNION SELECT \'Footer 2\' AS label,\'footer_2\' AS `id` UNION SELECT \'Footer 3\' AS label,\'footer_3\' AS `id` UNION SELECT \'Footer Custom\' AS label,\'footer_custom\' AS `id`\"}','');
  45.         ");
  46.         
  47.         // -- Breadcrumb
  48.         $this->addSql("
  49.             INSERT INTO `std_config` (`machine_name`, `created_by`, `updated_by`, `value`, `description_machine_name`, `details_machine_name`, `parent_name`, `variable_type`, `order_value`, `is_hidden`, `label`, `content`, `language_code`) VALUES 
  50.                 ('breadcrumb', '1', '1', 'breadcrumb', 'breadcrumb', 'breadcrumb', 'Theme', 'CHECKBOX', '12', '0', 'Breadcrumb',NULL,''),
  51.                 ('breadcrumb_align', '1', '1', 'breadcrumb_align', 'breadcrumb_align', 'breadcrumb_align', 'Theme', 'SELECT', '13', '0', 'Breadcrumb Align', '{\"query\": \"SELECT \'Left\' AS label,\'start\' AS `id` UNION SELECT \'Right\' AS label,\'end\' AS `id` UNION SELECT \'Center\' AS label,\'center\' AS `id`\"}','');
  52.         ");
  53.         // -- Footer 1
  54.         $this->addSql("
  55.             SET @id_ct_menus=(SELECT id FROM std_content_types WHERE machine_name='menus');
  56.             INSERT IGNORE INTO `std_pages` VALUES (NULL,NULL, 1, 1, @id_ct_menus, 1, now(), now(), NULL, now(), NULL,'Menu Footer 1','');
  57.         ");
  58.         $this->addSql("
  59.             SET @id_page_mt = LAST_INSERT_ID();     
  60.             INSERT IGNORE INTO `std_pages_content` VALUES (@id_page_mt, 'pt', 1, 1, 1, now(), now(), 'Menu Footer 1', '', NULL, '', '', '', '', '', '', '', '', '', '', '[]');              
  61.         ");
  62.         $this->addSql("
  63.                 INSERT IGNORE INTO `std_pages_pages` VALUES (NULL,@id_page_mt, 0, 1, @id_ct_menus);        
  64.         ");
  65.         $this->addSql("
  66.             SET @id_pp_mt = LAST_INSERT_ID();               
  67.             INSERT IGNORE INTO `std_content_types_skins` VALUES (@id_ct_menus, 'menufooter', 'Menu Footer', 1, 1, now(), 1, now());
  68.         ");
  69.         $this->addSql("
  70.             INSERT IGNORE INTO `std_config` VALUES ('menufooter1', 1, 1, @id_pp_mt, 'menufooter1', 'menufooter1', 'Menus', 'SELECT', 62, 0, 1, now(), now(), 'Menu Footer 1', '{\"query\": \"select sp.name as label,spp.id as id from std_pages sp LEFT OUTER JOIN std_pages_pages spp ON sp.id = spp.page_id LEFT OUTER JOIN std_content_types sct ON sp.content_type = sct.id inner join std_pages_content spc on sp.id=spc.page_id and spc.language_code=\'pt\' where sct.machine_name=\'menus\' AND spp.relation_id = 0\"}','pt');
  71.         ");
  72.         $this->addSql("
  73.             INSERT IGNORE INTO `std_config` VALUES ('menufooter1_skin', 1, 1, 'menufooter', 'menufooter1_skin', 'menufooter1_skin', 'Menus', 'SELECT', 63, 0, 1, now(), now(), 'Menu Footer 1 Skin', '{\"query\": \"select scts.name as label,scts.machine_name as id from std_content_types_skins scts LEFT OUTER JOIN std_content_types sct ON scts.content_type_id = sct.id WHERE sct.machine_name=\'menus\'\"}','pt');
  74.         ");
  75.         // -- Footer 2
  76.         $this->addSql("
  77.             SET @id_ct_menus=(SELECT id FROM std_content_types WHERE machine_name='menus');
  78.             INSERT IGNORE INTO `std_pages` VALUES (NULL,NULL, 1, 1, @id_ct_menus, 1, now(), now(), NULL, now(), NULL,'Menu Footer 2','');
  79.         ");
  80.         $this->addSql("
  81.             SET @id_page_mt = LAST_INSERT_ID();     
  82.             INSERT IGNORE INTO `std_pages_content` VALUES (@id_page_mt, 'pt', 1, 1, 1, now(), now(), 'Menu Footer ', '', NULL, '', '', '', '', '', '', '', '', '', '', '[]');              
  83.         ");
  84.         $this->addSql("
  85.             INSERT IGNORE INTO `std_pages_pages` VALUES (NULL,@id_page_mt, 0, 1, @id_ct_menus);        
  86.         ");
  87.         $this->addSql("
  88.             SET @id_pp_mt = LAST_INSERT_ID();               
  89.             INSERT IGNORE INTO `std_config` VALUES ('menufooter2', 1, 1, @id_pp_mt, 'menufooter2', 'menufooter2', 'Menus', 'SELECT', 68, 0, 1, now(), now(), 'Menu Footer 2', '{\"query\": \"select sp.name as label,spp.id as id from std_pages sp LEFT OUTER JOIN std_pages_pages spp ON sp.id = spp.page_id LEFT OUTER JOIN std_content_types sct ON sp.content_type = sct.id inner join std_pages_content spc on sp.id=spc.page_id and spc.language_code=\'pt\' where sct.machine_name=\'menus\' AND spp.relation_id = 0\"}','pt');
  90.         ");
  91.         $this->addSql("
  92.             INSERT IGNORE INTO `std_config` VALUES ('menufooter2_skin', 1, 1, 'menufooter', 'menufooter2_skin', 'menufooter2_skin', 'Menus', 'SELECT', 69, 0, 1, now(), now(), 'Menu Footer 2 Skin', '{\"query\": \"select scts.name as label,scts.machine_name as id from std_content_types_skins scts LEFT OUTER JOIN std_content_types sct ON scts.content_type_id = sct.id WHERE sct.machine_name=\'menus\'\"}','pt');
  93.         ");
  94.         // -- Footer 3
  95.         $this->addSql("
  96.             SET @id_ct_menus=(SELECT id FROM std_content_types WHERE machine_name='menus');
  97.             INSERT IGNORE INTO `std_pages` VALUES (NULL,NULL, 1, 1, @id_ct_menus, 1, now(), now(), NULL, now(), NULL,'Menu Footer 3','');
  98.         ");
  99.         $this->addSql("
  100.             SET @id_page_mt = LAST_INSERT_ID();     
  101.             INSERT IGNORE INTO `std_pages_content` VALUES (@id_page_mt, 'pt', 1, 1, 1, now(), now(), 'Menu Footer ', '', NULL, '', '', '', '', '', '', '', '', '', '', '[]');              
  102.         ");
  103.         $this->addSql("
  104.             INSERT IGNORE INTO `std_pages_pages` VALUES (NULL,@id_page_mt, 0, 1, @id_ct_menus);        
  105.         ");
  106.         $this->addSql("
  107.             SET @id_pp_mt = LAST_INSERT_ID();               
  108.             INSERT IGNORE INTO `std_config` VALUES ('menufooter3', 1, 1, @id_pp_mt, 'menufooter3', 'menufooter3', 'Menus', 'SELECT', 74, 0, 1, now(), now(), 'Menu Footer 3', '{\"query\": \"select sp.name as label,spp.id as id from std_pages sp LEFT OUTER JOIN std_pages_pages spp ON sp.id = spp.page_id LEFT OUTER JOIN std_content_types sct ON sp.content_type = sct.id inner join std_pages_content spc on sp.id=spc.page_id and spc.language_code=\'pt\'  where sct.machine_name=\'menus\' AND spp.relation_id = 0\"}','pt');
  109.         ");
  110.         $this->addSql("
  111.             INSERT IGNORE INTO `std_config` VALUES ('menufooter3_skin', 1, 1, 'menufooter', 'menufooter3_skin', 'menufooter3_skin', 'Menus', 'SELECT', 75, 0, 1, now(), now(), 'Menu Footer 3 Skin', '{\"query\": \"select scts.name as label,scts.machine_name as id from std_content_types_skins scts LEFT OUTER JOIN std_content_types sct ON scts.content_type_id = sct.id WHERE sct.machine_name=\'menus\'\"}','pt');
  112.         ");     
  113.         
  114.     }
  115.     public function down(Schema $schema) : void
  116.     {
  117.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='favicon';");
  118.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='logoemail';");
  119.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='facebook_url';");
  120.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='instagram_url';");
  121.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='linkedin_url';");
  122.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='youtube_url';");
  123.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='twitter_url';");
  124.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='footer_text';");
  125.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='footer_text2';");
  126.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='header_style';");
  127.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='footer_style';");
  128.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='breadcrumb';");
  129.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='breadcrumb_align';");
  130.         $this->addSql("DELETE FROM `std_pages_content` WHERE `title`='Menu Footer 1';");
  131.         $this->addSql("DELETE FROM `std_pages_content` WHERE `title`='Menu Footer 2';");
  132.         $this->addSql("DELETE FROM `std_pages_content` WHERE `title`='Menu Footer 3';");
  133.         $this->addSql("DELETE FROM `std_pages_pages` WHERE `page_id`=(SELECT `id` FROM `std_pages` WHERE `name`='Menu Footer 1');");
  134.         $this->addSql("DELETE FROM `std_pages_pages` WHERE `page_id`=(SELECT `id` FROM `std_pages` WHERE `name`='Menu Footer 2');");
  135.         $this->addSql("DELETE FROM `std_pages_pages` WHERE `page_id`=(SELECT `id` FROM `std_pages` WHERE `name`='Menu Footer 3');");
  136.         $this->addSql("DELETE FROM `std_pages` WHERE `name`='Menu Footer 1';");
  137.         $this->addSql("DELETE FROM `std_pages` WHERE `name`='Menu Footer 2';");
  138.         $this->addSql("DELETE FROM `std_pages` WHERE `name`='Menu Footer 3';");
  139.         $this->addSql("DELETE FROM `std_content_types_skins` WHERE `machine_name`='menufooter';");
  140.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='menufooter1';");
  141.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='menufooter1_skin';");
  142.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='menufooter2';");
  143.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='menufooter2_skin';");
  144.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='menufooter3';");
  145.         $this->addSql("DELETE FROM `std_config` WHERE `machine_name`='menufooter3_skin';");
  146.     }
  147. }