migrations/Version20240805153122.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 Version20240805153122 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return '';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('CREATE TABLE std_seo_benchmark (id INT AUTO_INCREMENT NOT NULL, updated_date DATETIME NOT NULL, meta_percentage float NOT NULL, og_percentage float NOT NULL, block_percentage float NOT NULL, missing_content LONGTEXT DEFAULT NULL, checked_pages LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  15.         $this->addSql('INSERT INTO std_seo_benchmark (id,updated_date,meta_percentage,og_percentage,block_percentage,checked_pages) VALUES (1,(SELECT CURDATE()),0,0,0,"{\"numberPages\":0,\"numberPagesMissingContent\":0}")');
  16.         
  17.         $this->addSql('INSERT INTO std_scheduler_commands (machine_name,name,is_active,is_stoppable) VALUES ("studio:sync-seo-benchmarks","Sync SEO Benchmarks",1,0)');
  18.         
  19.         $this->addSql('INSERT INTO std_scheduler_tasks (created_by,updated_by,scheduler_command_id,name,description,cron_expression,execute_at,is_active,created_date,updated_date) VALUES (1,1,(SELECT `id` from `std_scheduler_commands` where `machine_name`="studio:sync-seo-benchmarks"),"Update SEO Benchmarks","Update SEO Benchmarks","0 0 * * *",(SELECT CURDATE()),1,(SELECT CURDATE()),(SELECT CURDATE()))');
  20.     }
  21.         
  22.     public function down(Schema $schema): void
  23.     {
  24.         $this->addSql('DROP TABLE std_seo_benchmark');
  25.         $this->addSql("DELETE FROM `std_scheduler_tasks` WHERE `scheduler_command_id` = (SELECT `id` FROM `std_scheduler_commands` WHERE `machine_name` = 'studio:sync-seo-benchmarks');");
  26.         $this->addSql("DELETE FROM `std_scheduler_commands` WHERE `machine_name` = 'studio:sync-seo-benchmarks';");
  27.         
  28.     }
  29. }