migrations/Version20261105171539.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20261105171539 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE tiktok_account (id INT AUTO_INCREMENT NOT NULL, social_media_id INT NOT NULL, username VARCHAR(255) DEFAULT NULL, access_token_encrypted LONGTEXT DEFAULT NULL, refresh_token_encrypted LONGTEXT NOT NULL, access_token_expires_at DATETIME DEFAULT NULL, scope LONGTEXT DEFAULT NULL, revoked TINYINT(1) NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_2EA3546C64AE4959 (social_media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE tiktok_account ADD CONSTRAINT FK_2EA3546C64AE4959 FOREIGN KEY (social_media_id) REFERENCES social_media (id) ON DELETE CASCADE');
  20.         $this->addSql('ALTER TABLE post_record CHANGE raw_metrics raw_metrics JSON DEFAULT NULL COMMENT \'(DC2Type:json)\', CHANGE metrics metrics JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
  21.         $this->addSql('ALTER TABLE record_social_media CHANGE raw_metrics raw_metrics JSON DEFAULT NULL COMMENT \'(DC2Type:json)\', CHANGE metrics metrics JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
  22.         $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\'');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE tiktok_account DROP FOREIGN KEY FK_2EA3546C64AE4959');
  28.         $this->addSql('DROP TABLE tiktok_account');
  29.         $this->addSql('ALTER TABLE post_record CHANGE raw_metrics raw_metrics JSON DEFAULT NULL COMMENT \'(DC2Type:json)\', CHANGE metrics metrics JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
  30.         $this->addSql('ALTER TABLE record_social_media CHANGE raw_metrics raw_metrics JSON DEFAULT NULL COMMENT \'(DC2Type:json)\', CHANGE metrics metrics JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
  31.         $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\'');
  32.     }
  33. }