<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* One-account-only TikTok: 90-day submission-account lock.
*
* Adds the lock fields to creator. The lock keys on the stable TikTok union_id (the @handle is
* mutable). Lock state self-establishes on the creator's next OAuth (CreatorService Case 1); a
* deliberate bulk seed of existing active accounts is done out-of-band via
* `app:creator:backfill-tiktok-lock`, NOT in this migration, so the schema change is trivial and
* cannot brick a deploy on existing data.
*/
final class Version20260629120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add TikTok submission-account lock fields (locked_tik_tok_union_id, locked_at) to creator';
}
public function up(Schema $schema): void
{
$this->addSql(
"ALTER TABLE creator "
. "ADD locked_tik_tok_union_id BINARY(16) DEFAULT NULL COMMENT '(DC2Type:uuid)', "
. "ADD locked_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)'"
);
$this->addSql('CREATE INDEX idx_creator_locked_union ON creator (locked_tik_tok_union_id)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX idx_creator_locked_union ON creator');
$this->addSql('ALTER TABLE creator DROP locked_tik_tok_union_id, DROP locked_at');
}
}