<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260404120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add conversation_group_id to conversation_turn, conversation_message, and token_transaction for grouping related sessions';
}
public function up(Schema $schema): void
{
$turnTable = $schema->getTable('conversation_turn');
if (!$turnTable->hasColumn('conversation_group_id')) {
$this->addSql('ALTER TABLE conversation_turn ADD conversation_group_id VARCHAR(64) DEFAULT NULL');
}
$msgTable = $schema->getTable('conversation_message');
if (!$msgTable->hasColumn('conversation_group_id')) {
$this->addSql('ALTER TABLE conversation_message ADD conversation_group_id VARCHAR(64) DEFAULT NULL');
}
$txTable = $schema->getTable('token_transaction');
if (!$txTable->hasColumn('conversation_group_id')) {
$this->addSql('ALTER TABLE token_transaction ADD conversation_group_id VARCHAR(64) DEFAULT NULL');
}
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE conversation_turn DROP COLUMN conversation_group_id');
$this->addSql('ALTER TABLE conversation_message DROP COLUMN conversation_group_id');
$this->addSql('ALTER TABLE token_transaction DROP COLUMN conversation_group_id');
}
}