<?php
declare(strict_types=1);
namespace CoreMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220331143623 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->addSql('CREATE TABLE customers_bundle__customer_group_customer (customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', customer_group_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_85C42ABD9395C3F3 (customer_id), INDEX IDX_85C42ABDD2919A68 (customer_group_id), PRIMARY KEY(customer_id, customer_group_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE customers_bundle__customer_group (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(32) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_5641E104B03A8386 (created_by_id), INDEX IDX_5641E104896DBBDE (updated_by_id), INDEX IDX_5641E104C76F1F52 (deleted_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE customers_bundle__customer_group_translations (id INT AUTO_INCREMENT NOT NULL, object_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', locale VARCHAR(8) NOT NULL, field VARCHAR(32) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX IDX_2CA9AD1F232D562B (object_id), UNIQUE INDEX lookup_unique_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE customers_bundle__customer_group_customer ADD CONSTRAINT FK_85C42ABD9395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE customers_bundle__customer_group_customer ADD CONSTRAINT FK_85C42ABDD2919A68 FOREIGN KEY (customer_group_id) REFERENCES customers_bundle__customer_group (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE customers_bundle__customer_group ADD CONSTRAINT FK_5641E104B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE customers_bundle__customer_group ADD CONSTRAINT FK_5641E104896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE customers_bundle__customer_group ADD CONSTRAINT FK_5641E104C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE customers_bundle__customer_group_translations ADD CONSTRAINT FK_2CA9AD1F232D562B FOREIGN KEY (object_id) REFERENCES customers_bundle__customer_group (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE currency CHANGE change_rate change_rate NUMERIC(20, 12) DEFAULT \'1\' NOT NULL');
$this->addSql('ALTER TABLE customers_bundle__customer ADD customer_group_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE customers_bundle__customer ADD CONSTRAINT FK_1FD6BD95D2919A68 FOREIGN KEY (customer_group_id) REFERENCES customers_bundle__customer_group (id)');
$this->addSql('CREATE INDEX IDX_1FD6BD95D2919A68 ON customers_bundle__customer (customer_group_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE customers_bundle__customer DROP FOREIGN KEY FK_1FD6BD95D2919A68');
$this->addSql('ALTER TABLE customers_bundle__customer_group_customer DROP FOREIGN KEY FK_85C42ABDD2919A68');
$this->addSql('ALTER TABLE customers_bundle__customer_group_translations DROP FOREIGN KEY FK_2CA9AD1F232D562B');
$this->addSql('DROP TABLE customers_bundle__customer_group_customer');
$this->addSql('DROP TABLE customers_bundle__customer_group');
$this->addSql('DROP TABLE customers_bundle__customer_group_translations');
$this->addSql('ALTER TABLE currency CHANGE change_rate change_rate NUMERIC(20, 12) DEFAULT \'1.000000000000\' NOT NULL');
$this->addSql('DROP INDEX IDX_1FD6BD95D2919A68 ON customers_bundle__customer');
$this->addSql('ALTER TABLE customers_bundle__customer DROP customer_group_id');
}
}