<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20241017000000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add candidate_communication table to store notifications, reminders, and alert rules';
}
public function up(Schema $schema): void
{
if ($schema->hasTable('candidate_communication')) {
return;
}
$table = $schema->createTable('candidate_communication');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('title', 'string', ['length' => 255]);
$table->addColumn('category', 'string', ['length' => 50]);
$table->addColumn('recipients', 'json');
$table->addColumn('message', 'text');
$table->addColumn('scheduled_at', 'datetime_immutable', ['notnull' => false]);
$table->addColumn('metadata', 'json');
$table->addColumn('created_at', 'datetime_immutable');
$table->setPrimaryKey(['id']);
$table->addIndex(['category'], 'idx_candidate_communication_category');
$table->addIndex(['scheduled_at'], 'idx_candidate_communication_schedule');
}
public function down(Schema $schema): void
{
if ($schema->hasTable('candidate_communication')) {
$schema->dropTable('candidate_communication');
}
}
}