migrations/Version20220221150454.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 Version20220221150454 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $this->addSql('ALTER TABLE std_content_types CHANGE machine_name_categories machine_name_categories VARCHAR(50) DEFAULT NULL COMMENT \'Unique code used in the programming to identify the content type category\'');
  20.         $this->addSql("
  21.         set @exist_Check := (
  22.             select count(*) from information_schema.columns 
  23.             where TABLE_NAME='std_content_types_skins' 
  24.             and COLUMN_NAME='path' 
  25.             and TABLE_SCHEMA=database()
  26.         ) ;
  27.         set @sqlstmt := if(@exist_Check>0,'alter table std_content_types_skins drop column path', 'select ''''') ;
  28.         prepare stmt from @sqlstmt ;
  29.         execute stmt ;");
  30.         $this->addSql('ALTER TABLE std_templates_blocks ADD block_machine_name VARCHAR(50) DEFAULT NULL COMMENT \'Unique code used in the programming to identify the block\'');
  31.         $this->addSql('CREATE UNIQUE INDEX idx_machine_name ON std_content_types (machine_name)');
  32.     }
  33.     public function down(Schema $schema) : void
  34.     {
  35.         // this down() migration is auto-generated, please modify it to your needs
  36.         $this->addSql('DROP INDEX idx_machine_name ON std_content_types');
  37.         $this->addSql('ALTER TABLE std_templates_blocks DROP block_machine_name');
  38.         $this->addSql('ALTER TABLE std_content_types_skins ADD path VARCHAR(250) NOT NULL COLLATE utf8mb4_unicode_ci COMMENT \'Path to the skin file\'');
  39.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  40.         $this->addSql('ALTER TABLE std_content_types CHANGE machine_name_categories machine_name_categories VARCHAR(50) DEFAULT NULL COLLATE utf8mb4_unicode_ci COMMENT \'Unique code used in the programming to identify the content ENGINE category\'');
  41.     }
  42. }