<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add EPG CSV delimiter configuration.
* Allows configuring the delimiter used when parsing EPG CSV files.
*/
final class Version20251229120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add epg_csv_delimiter configuration for EPG CSV file parsing';
}
public function up(Schema $schema): void
{
// Get the next order_value for System parent
$this->addSql("
SET @order_value = COALESCE((SELECT MAX(`order_value`) FROM `std_config` WHERE `parent_name` = 'System'), 0) + 1
");
$this->addSql("
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`,
`is_active`,
`created_date`,
`updated_date`,
`label`,
`content`,
`language_code`
) VALUES (
'epg_csv_delimiter',
1,
1,
';',
'epg_csv_delimiter',
'Character used as delimiter in EPG CSV files. Common values: ; (semicolon) or , (comma). Must be a single character.',
'System',
'INPUT',
@order_value,
0,
1,
NOW(),
NOW(),
'EPG CSV Delimiter',
NULL,
''
)
");
}
public function down(Schema $schema): void
{
$this->addSql("DELETE FROM `std_config` WHERE `machine_name` = 'epg_csv_delimiter'");
}
}