<?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 Version20251230120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Update watchtv_pages and add guidetv config with system content type filter';
}
public function up(Schema $schema): void
{
// Update watchtv_pages and guidetv to use 'system' content type filter
$this->addSql("
UPDATE `std_config`
SET `content` = '{\"query\": \"select p.`name` as label,p.id as id from std_pages p INNER JOIN std_content_types sct ON p.content_type = sct.id where sct.machine_name LIKE \\'system\\'\"}'
WHERE `machine_name` IN ('watchtv_pages', 'guidetv');
");
}
public function down(Schema $schema): void
{
// Revert watchtv_pages to use 'pages' content type filter
$this->addSql("
UPDATE `std_config`
SET `content` = '{\"query\": \"select p.`name` as label,p.id as id from std_pages p INNER JOIN std_content_types sct ON p.content_type = sct.id where sct.machine_name LIKE \\'pages\\'\"}'
WHERE `machine_name` = 'watchtv_pages';
");
// Remove guidetv config
$this->addSql("DELETE FROM `std_config` WHERE `machine_name` = 'guidetv';");
}
}