<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Adds posting_language to creator_classification.
*
* The classifier captures the creator's POSTING language as TikTok's own
* per-post `textLanguage`, taken as the mode over the creator's recent posts
* (ISO code, e.g. en/es/pt/tl). This is the language the creator actually
* publishes in — distinct from, and more reliable than, the sparsely-populated
* scraping_creators_data.language (the account's app/profile language).
*
* The sponsor statistics strip's "Primary Language" already reads
* scraping_creators_data.language; the renderer is extended to fall back to this
* column so language shows for every classified creator, not just the minority
* with a scraped-profile row. creator_classification is excluded from Doctrine's
* schema_filter, so this explicit ALTER is required (auto-diff ignores the table).
*/
final class Version20260627120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add posting_language (TikTok textLanguage mode) to creator_classification';
}
public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE creator_classification ADD posting_language VARCHAR(8) DEFAULT NULL COMMENT 'Posting language = mode of TikTok per-post textLanguage (ISO code)'");
$this->addSql('CREATE INDEX idx_cc_posting_language ON creator_classification (posting_language)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX idx_cc_posting_language ON creator_classification');
$this->addSql('ALTER TABLE creator_classification DROP posting_language');
}
}