migrations/Version20260629120000.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.  * One-account-only TikTok: 90-day submission-account lock.
  8.  *
  9.  * Adds the lock fields to creator. The lock keys on the stable TikTok union_id (the @handle is
  10.  * mutable). Lock state self-establishes on the creator's next OAuth (CreatorService Case 1); a
  11.  * deliberate bulk seed of existing active accounts is done out-of-band via
  12.  * `app:creator:backfill-tiktok-lock`, NOT in this migration, so the schema change is trivial and
  13.  * cannot brick a deploy on existing data.
  14.  */
  15. final class Version20260629120000 extends AbstractMigration
  16. {
  17.     public function getDescription(): string
  18.     {
  19.         return 'Add TikTok submission-account lock fields (locked_tik_tok_union_id, locked_at) to creator';
  20.     }
  21.     public function up(Schema $schema): void
  22.     {
  23.         $this->addSql(
  24.             "ALTER TABLE creator "
  25.             "ADD locked_tik_tok_union_id BINARY(16) DEFAULT NULL COMMENT '(DC2Type:uuid)', "
  26.             "ADD locked_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)'"
  27.         );
  28.         $this->addSql('CREATE INDEX idx_creator_locked_union ON creator (locked_tik_tok_union_id)');
  29.     }
  30.     public function down(Schema $schema): void
  31.     {
  32.         $this->addSql('DROP INDEX idx_creator_locked_union ON creator');
  33.         $this->addSql('ALTER TABLE creator DROP locked_tik_tok_union_id, DROP locked_at');
  34.     }
  35. }