<?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 Version20190515132626 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_attributes DROP FOREIGN KEY FK_9CBB7EA741BCBAEC');
$this->addSql('ALTER TABLE std_content_types_attributes DROP FOREIGN KEY FK_9CBB7EA7B6E62EFA');
$this->addSql('DROP INDEX IDX_9CBB7EA741BCBAEC ON std_content_types_attributes');
$this->addSql('DROP INDEX IDX_9CBB7EA7B6E62EFA ON std_content_types_attributes');
$this->addSql('ALTER TABLE std_content_types_attributes DROP PRIMARY KEY');
$this->addSql('ALTER TABLE std_content_types_attributes ADD content_type_machine_name VARCHAR(50) NOT NULL COMMENT \'Content type machine name\', ADD attribute_machine_name VARCHAR(50) NOT NULL COMMENT \'Attribute machine name\', DROP content_type, DROP attribute_id');
$this->addSql('ALTER TABLE std_content_types_attributes ADD PRIMARY KEY (content_type_machine_name, attribute_machine_name)');
}
public function down(Schema $schema) : void
{
// this down() 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_attributes DROP PRIMARY KEY');
$this->addSql('ALTER TABLE std_content_types_attributes ADD content_type INT UNSIGNED NOT NULL COMMENT \'Unique identifier\', ADD attribute_id INT UNSIGNED NOT NULL COMMENT \'Attribute unique identifier\', DROP content_type_machine_name, DROP attribute_machine_name');
$this->addSql('ALTER TABLE std_content_types_attributes ADD CONSTRAINT FK_9CBB7EA741BCBAEC FOREIGN KEY (content_type) REFERENCES std_content_types (id)');
$this->addSql('ALTER TABLE std_content_types_attributes ADD CONSTRAINT FK_9CBB7EA7B6E62EFA FOREIGN KEY (attribute_id) REFERENCES std_attributes (id)');
$this->addSql('CREATE INDEX IDX_9CBB7EA741BCBAEC ON std_content_types_attributes (content_type)');
$this->addSql('CREATE INDEX IDX_9CBB7EA7B6E62EFA ON std_content_types_attributes (attribute_id)');
$this->addSql('ALTER TABLE std_content_types_attributes ADD PRIMARY KEY (content_type, attribute_id)');
}
}