<?php
declare(strict_types=1);
namespace ProductsBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230120123514 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE products_bundle__attachment (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', file_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(255) NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_7E5AFE6A93CB796C (file_id), INDEX IDX_7E5AFE6AB03A8386 (created_by_id), INDEX IDX_7E5AFE6A896DBBDE (updated_by_id), INDEX IDX_7E5AFE6AC76F1F52 (deleted_by_id), INDEX name (name), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__attachment_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_776D09D7232D562B (object_id), FULLTEXT INDEX content (content), UNIQUE INDEX lookup_unique_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__product_attachment (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', attachment_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_C878BAA3464E68B (attachment_id), INDEX IDX_C878BAA34584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE products_bundle__attachment ADD CONSTRAINT FK_7E5AFE6A93CB796C FOREIGN KEY (file_id) REFERENCES file_manager (id)');
$this->addSql('ALTER TABLE products_bundle__attachment ADD CONSTRAINT FK_7E5AFE6AB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attachment ADD CONSTRAINT FK_7E5AFE6A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attachment ADD CONSTRAINT FK_7E5AFE6AC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attachment_translations ADD CONSTRAINT FK_776D09D7232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__attachment (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE products_bundle__product_attachment ADD CONSTRAINT FK_C878BAA3464E68B FOREIGN KEY (attachment_id) REFERENCES products_bundle__attachment (id)');
$this->addSql('ALTER TABLE products_bundle__product_attachment ADD CONSTRAINT FK_C878BAA34584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE products_bundle__attachment DROP FOREIGN KEY FK_7E5AFE6A93CB796C');
$this->addSql('ALTER TABLE products_bundle__attachment DROP FOREIGN KEY FK_7E5AFE6AB03A8386');
$this->addSql('ALTER TABLE products_bundle__attachment DROP FOREIGN KEY FK_7E5AFE6A896DBBDE');
$this->addSql('ALTER TABLE products_bundle__attachment DROP FOREIGN KEY FK_7E5AFE6AC76F1F52');
$this->addSql('ALTER TABLE products_bundle__attachment_translations DROP FOREIGN KEY FK_776D09D7232D562B');
$this->addSql('ALTER TABLE products_bundle__product_attachment DROP FOREIGN KEY FK_C878BAA3464E68B');
$this->addSql('ALTER TABLE products_bundle__product_attachment DROP FOREIGN KEY FK_C878BAA34584665A');
$this->addSql('DROP TABLE products_bundle__attachment');
$this->addSql('DROP TABLE products_bundle__attachment_translations');
$this->addSql('DROP TABLE products_bundle__product_attachment');
}
}