migrations/Version20260627120000.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Adds posting_language to creator_classification.
  8.  *
  9.  * The classifier captures the creator's POSTING language as TikTok's own
  10.  * per-post `textLanguage`, taken as the mode over the creator's recent posts
  11.  * (ISO code, e.g. en/es/pt/tl). This is the language the creator actually
  12.  * publishes in — distinct from, and more reliable than, the sparsely-populated
  13.  * scraping_creators_data.language (the account's app/profile language).
  14.  *
  15.  * The sponsor statistics strip's "Primary Language" already reads
  16.  * scraping_creators_data.language; the renderer is extended to fall back to this
  17.  * column so language shows for every classified creator, not just the minority
  18.  * with a scraped-profile row. creator_classification is excluded from Doctrine's
  19.  * schema_filter, so this explicit ALTER is required (auto-diff ignores the table).
  20.  */
  21. final class Version20260627120000 extends AbstractMigration
  22. {
  23.     public function getDescription(): string
  24.     {
  25.         return 'Add posting_language (TikTok textLanguage mode) to creator_classification';
  26.     }
  27.     public function up(Schema $schema): void
  28.     {
  29.         $this->addSql("ALTER TABLE creator_classification ADD posting_language VARCHAR(8) DEFAULT NULL COMMENT 'Posting language = mode of TikTok per-post textLanguage (ISO code)'");
  30.         $this->addSql('CREATE INDEX idx_cc_posting_language ON creator_classification (posting_language)');
  31.     }
  32.     public function down(Schema $schema): void
  33.     {
  34.         $this->addSql('DROP INDEX idx_cc_posting_language ON creator_classification');
  35.         $this->addSql('ALTER TABLE creator_classification DROP posting_language');
  36.     }
  37. }