<?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 Version20231117193102 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
//get default language code
$this->addSql("SET @defaultlang=(SELECT `language_code` FROM `std_languages` WHERE `is_default`=1 LIMIT 1);");
$this->addSql("UPDATE `std_config` set content='{\"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=@defaultlang where sct.machine_name LIKE \'menus\' AND spp.relation_id = 0\"}',language_code=@defaultlang where machine_name in ('menutop','menutop2','menufooter1','menufooter2','menufooter3','menufooter4') and coalesce(language_code,'')='';");
$this->addSql("UPDATE `std_config` set content=concat('{\"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=''',language_code,''' where sct.machine_name LIKE \'menus\' AND spp.relation_id = 0\"}') where machine_name in ('menutop','menutop2','menufooter1','menufooter2','menufooter3','menufooter4');");
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}