<?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 Version20210909165508 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('CREATE TABLE std_attributes_content (id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT \'Attribute content unique identifier\', attribute_id INT UNSIGNED DEFAULT NULL COMMENT \'Attribute unique identifier\', language_code VARCHAR(2) DEFAULT NULL COMMENT \'ISO 639 Language code\', created_by INT UNSIGNED DEFAULT NULL COMMENT \'Unique identifier\', updated_by INT UNSIGNED DEFAULT NULL COMMENT \'Unique identifier\', name VARCHAR(50) NOT NULL COMMENT \'Attribute name\', created_date DATETIME NOT NULL COMMENT \'Date and time of the record creation\', updated_date DATETIME NOT NULL COMMENT \'Date and time the record was last updated\', INDEX IDX_29AE36EDB6E62EFA (attribute_id), INDEX IDX_29AE36ED451CDAD4 (language_code), INDEX fk_std_attributes_std_users (created_by), INDEX fk_std_attributes_std_users_0 (updated_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE std_attributes_values_content (id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT \'Attribute value content unique identifier\', attribute_value_id INT UNSIGNED DEFAULT NULL COMMENT \'Attribute value unique identifier\', language_code VARCHAR(2) DEFAULT NULL COMMENT \'ISO 639 Language code\', label VARCHAR(255) NOT NULL COMMENT \'Attribute value label\', INDEX IDX_906D164565A22152 (attribute_value_id), INDEX IDX_906D1645451CDAD4 (language_code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE std_attributes_content ADD CONSTRAINT FK_29AE36EDB6E62EFA FOREIGN KEY (attribute_id) REFERENCES std_attributes (id)');
$this->addSql('ALTER TABLE std_attributes_content ADD CONSTRAINT FK_29AE36ED451CDAD4 FOREIGN KEY (language_code) REFERENCES std_languages (language_code)');
$this->addSql('ALTER TABLE std_attributes_content ADD CONSTRAINT FK_29AE36EDDE12AB56 FOREIGN KEY (created_by) REFERENCES std_users (id)');
$this->addSql('ALTER TABLE std_attributes_content ADD CONSTRAINT FK_29AE36ED16FE72E1 FOREIGN KEY (updated_by) REFERENCES std_users (id)');
$this->addSql('ALTER TABLE std_attributes_values_content ADD CONSTRAINT FK_906D164565A22152 FOREIGN KEY (attribute_value_id) REFERENCES std_attributes_values (id)');
$this->addSql('ALTER TABLE std_attributes_values_content ADD CONSTRAINT FK_906D1645451CDAD4 FOREIGN KEY (language_code) REFERENCES std_languages (language_code)');
$this->addSql('ALTER TABLE std_attributes_values CHANGE attribute_id attribute_id INT UNSIGNED DEFAULT NULL COMMENT \'Attribute unique identifier\'');
$this->addSql('ALTER TABLE std_attributes_values RENAME INDEX fk_std_attributes_values_std_attributes TO IDX_5C73E607B6E62EFA');
}
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('DROP TABLE std_attributes_content');
$this->addSql('DROP TABLE std_attributes_values_content');
$this->addSql('ALTER TABLE std_attributes_values CHANGE attribute_id attribute_id INT UNSIGNED NOT NULL COMMENT \'Attribute unique identifier\'');
$this->addSql('ALTER TABLE std_attributes_values RENAME INDEX idx_5c73e607b6e62efa TO FK_std_attributes_values_std_attributes');
}
}