migrations/Version20250119183414.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.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20250119183414 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 youtube_auth (id VARCHAR(255) NOT NULL, channel_id VARCHAR(255) DEFAULT NULL, access_token VARCHAR(255) NOT NULL, refresh_token VARCHAR(255) NOT NULL, scope LONGTEXT NOT NULL, token_type VARCHAR(255) NOT NULL, expired_in INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_7F4CA87F72F5A1AA (channel_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE creator ADD youtube_auth_id VARCHAR(255) DEFAULT NULL');
  20.         $this->addSql('ALTER TABLE creator ADD CONSTRAINT FK_BC06EA638082819C FOREIGN KEY (youtube_auth_id) REFERENCES youtube_auth (id)');
  21.         $this->addSql('CREATE UNIQUE INDEX UNIQ_BC06EA632058D178 ON creator (youtube_auth_id)');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->addSql('ALTER TABLE creator DROP FOREIGN KEY FK_BC06EA632058D178');
  27.         $this->addSql('DROP TABLE youtube_auth');
  28.         $this->addSql('DROP INDEX UNIQ_BC06EA632058D178 ON creator');
  29.         $this->addSql('ALTER TABLE creator DROP youtube_auth_id');
  30.     }
  31. }