<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220221150454 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$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\'');
$this->addSql("
set @exist_Check := (
select count(*) from information_schema.columns
where TABLE_NAME='std_content_types_skins'
and COLUMN_NAME='path'
and TABLE_SCHEMA=database()
) ;
set @sqlstmt := if(@exist_Check>0,'alter table std_content_types_skins drop column path', 'select ''''') ;
prepare stmt from @sqlstmt ;
execute stmt ;");
$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\'');
$this->addSql('CREATE UNIQUE INDEX idx_machine_name ON std_content_types (machine_name)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX idx_machine_name ON std_content_types');
$this->addSql('ALTER TABLE std_templates_blocks DROP block_machine_name');
$this->addSql('ALTER TABLE std_content_types_skins ADD path VARCHAR(250) NOT NULL COLLATE utf8mb4_unicode_ci COMMENT \'Path to the skin file\'');
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$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\'');
}
}