<?php
declare(strict_types=1);
namespace ProductsBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230126121420 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE products_bundle__declination_image (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_image_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', declination_id BINARY(16) DEFAULT 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)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_C7E3924FF6154FFA (product_image_id), INDEX IDX_C7E3924F9941A932 (declination_id), INDEX IDX_C7E3924FB03A8386 (created_by_id), INDEX IDX_C7E3924F896DBBDE (updated_by_id), INDEX IDX_C7E3924FC76F1F52 (deleted_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__product_image (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_context_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)\', legend VARCHAR(255) NOT NULL, position INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, is_cover TINYINT(1) DEFAULT 1 NOT NULL, INDEX IDX_428566E9F8679EE4 (product_context_id), INDEX IDX_428566E9B03A8386 (created_by_id), INDEX IDX_428566E9896DBBDE (updated_by_id), INDEX IDX_428566E9C76F1F52 (deleted_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__product_image_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_EE76CA27232D562B (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('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924FF6154FFA FOREIGN KEY (product_image_id) REFERENCES products_bundle__product_image (id)');
$this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924F9941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924FB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924F896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924FC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_image ADD CONSTRAINT FK_428566E9F8679EE4 FOREIGN KEY (product_context_id) REFERENCES products_bundle__product_context (id)');
$this->addSql('ALTER TABLE products_bundle__product_image ADD CONSTRAINT FK_428566E9B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_image ADD CONSTRAINT FK_428566E9896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_image ADD CONSTRAINT FK_428566E9C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_image_translations ADD CONSTRAINT FK_EE76CA27232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__product_image (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924FF6154FFA');
$this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924F9941A932');
$this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924FB03A8386');
$this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924F896DBBDE');
$this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924FC76F1F52');
$this->addSql('ALTER TABLE products_bundle__product_image DROP FOREIGN KEY FK_428566E9F8679EE4');
$this->addSql('ALTER TABLE products_bundle__product_image DROP FOREIGN KEY FK_428566E9B03A8386');
$this->addSql('ALTER TABLE products_bundle__product_image DROP FOREIGN KEY FK_428566E9896DBBDE');
$this->addSql('ALTER TABLE products_bundle__product_image DROP FOREIGN KEY FK_428566E9C76F1F52');
$this->addSql('ALTER TABLE products_bundle__product_image_translations DROP FOREIGN KEY FK_EE76CA27232D562B');
$this->addSql('DROP TABLE products_bundle__declination_image');
$this->addSql('DROP TABLE products_bundle__product_image');
$this->addSql('DROP TABLE products_bundle__product_image_translations');
}
}