vendor/bluue/products-bundle/migrations/Version20230126121420.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace ProductsBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20230126121420 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $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');
  11.         $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');
  12.         $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');
  13.         $this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924FF6154FFA FOREIGN KEY (product_image_id) REFERENCES products_bundle__product_image (id)');
  14.         $this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924F9941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
  15.         $this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924FB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
  16.         $this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924F896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
  17.         $this->addSql('ALTER TABLE products_bundle__declination_image ADD CONSTRAINT FK_C7E3924FC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
  18.         $this->addSql('ALTER TABLE products_bundle__product_image ADD CONSTRAINT FK_428566E9F8679EE4 FOREIGN KEY (product_context_id) REFERENCES products_bundle__product_context (id)');
  19.         $this->addSql('ALTER TABLE products_bundle__product_image ADD CONSTRAINT FK_428566E9B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
  20.         $this->addSql('ALTER TABLE products_bundle__product_image ADD CONSTRAINT FK_428566E9896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
  21.         $this->addSql('ALTER TABLE products_bundle__product_image ADD CONSTRAINT FK_428566E9C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
  22.         $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');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         $this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924FF6154FFA');
  27.         $this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924F9941A932');
  28.         $this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924FB03A8386');
  29.         $this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924F896DBBDE');
  30.         $this->addSql('ALTER TABLE products_bundle__declination_image DROP FOREIGN KEY FK_C7E3924FC76F1F52');
  31.         $this->addSql('ALTER TABLE products_bundle__product_image DROP FOREIGN KEY FK_428566E9F8679EE4');
  32.         $this->addSql('ALTER TABLE products_bundle__product_image DROP FOREIGN KEY FK_428566E9B03A8386');
  33.         $this->addSql('ALTER TABLE products_bundle__product_image DROP FOREIGN KEY FK_428566E9896DBBDE');
  34.         $this->addSql('ALTER TABLE products_bundle__product_image DROP FOREIGN KEY FK_428566E9C76F1F52');
  35.         $this->addSql('ALTER TABLE products_bundle__product_image_translations DROP FOREIGN KEY FK_EE76CA27232D562B');
  36.         $this->addSql('DROP TABLE products_bundle__declination_image');
  37.         $this->addSql('DROP TABLE products_bundle__product_image');
  38.         $this->addSql('DROP TABLE products_bundle__product_image_translations');
  39.     }
  40. }