migrations/Version20250516080900.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. final class Version20250516080900 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Create table for analytics data from creator app screenshots';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('CREATE TABLE analytics_creators_data (id BIGINT UNSIGNED NOT NULL, subscribers JSON NOT NULL, viewers JSON NOT NULL, genders_by_subscribers JSON NOT NULL, genders_by_viewers JSON NOT NULL, ages_by_subscribers JSON NOT NULL, ages_by_viewers JSON NOT NULL, locations_by_subscribers JSON NOT NULL, locations_by_viewers JSON NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  15.         $this->addSql('ALTER TABLE analytics_creators_data ADD CONSTRAINT FK_67A87C49BF396750 FOREIGN KEY (id) REFERENCES creator (id) ON DELETE CASCADE');
  16.     }
  17.     public function down(Schema $schema): void
  18.     {
  19.         $this->addSql('ALTER TABLE analytics_creators_data DROP FOREIGN KEY FK_67A87C49BF396750');
  20.         $this->addSql('DROP TABLE analytics_creators_data');
  21.     }
  22. }