<?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 Version20220311082613 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 image (id INT AUTO_INCREMENT NOT NULL, url LONGTEXT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE image_set (id INT AUTO_INCREMENT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE image_set_image (image_set_id INT NOT NULL, image_id INT NOT NULL, INDEX IDX_894E236DBFE653D0 (image_set_id), INDEX IDX_894E236D3DA5256D (image_id), PRIMARY KEY(image_set_id, image_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE image_set_product (image_set_id INT NOT NULL, product_id INT NOT NULL, INDEX IDX_9B30A9C4BFE653D0 (image_set_id), INDEX IDX_9B30A9C44584665A (product_id), PRIMARY KEY(image_set_id, product_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE image_tag (id INT AUTO_INCREMENT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE image_tag_image (image_tag_id INT NOT NULL, image_id INT NOT NULL, INDEX IDX_3F53C60D15CF3DD9 (image_tag_id), INDEX IDX_3F53C60D3DA5256D (image_id), PRIMARY KEY(image_tag_id, image_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE image_tag_image_set (image_tag_id INT NOT NULL, image_set_id INT NOT NULL, INDEX IDX_EBC72DA315CF3DD9 (image_tag_id), INDEX IDX_EBC72DA3BFE653D0 (image_set_id), PRIMARY KEY(image_tag_id, image_set_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE image_set_image ADD CONSTRAINT FK_894E236DBFE653D0 FOREIGN KEY (image_set_id) REFERENCES image_set (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_set_image ADD CONSTRAINT FK_894E236D3DA5256D FOREIGN KEY (image_id) REFERENCES image (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_set_product ADD CONSTRAINT FK_9B30A9C4BFE653D0 FOREIGN KEY (image_set_id) REFERENCES image_set (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_set_product ADD CONSTRAINT FK_9B30A9C44584665A FOREIGN KEY (product_id) REFERENCES product (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_tag_image ADD CONSTRAINT FK_3F53C60D15CF3DD9 FOREIGN KEY (image_tag_id) REFERENCES image_tag (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_tag_image ADD CONSTRAINT FK_3F53C60D3DA5256D FOREIGN KEY (image_id) REFERENCES image (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_tag_image_set ADD CONSTRAINT FK_EBC72DA315CF3DD9 FOREIGN KEY (image_tag_id) REFERENCES image_tag (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_tag_image_set ADD CONSTRAINT FK_EBC72DA3BFE653D0 FOREIGN KEY (image_set_id) REFERENCES image_set (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE discount ADD amount INT NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE image_set_image DROP FOREIGN KEY FK_894E236D3DA5256D');
$this->addSql('ALTER TABLE image_tag_image DROP FOREIGN KEY FK_3F53C60D3DA5256D');
$this->addSql('ALTER TABLE image_set_image DROP FOREIGN KEY FK_894E236DBFE653D0');
$this->addSql('ALTER TABLE image_set_product DROP FOREIGN KEY FK_9B30A9C4BFE653D0');
$this->addSql('ALTER TABLE image_tag_image_set DROP FOREIGN KEY FK_EBC72DA3BFE653D0');
$this->addSql('ALTER TABLE image_tag_image DROP FOREIGN KEY FK_3F53C60D15CF3DD9');
$this->addSql('ALTER TABLE image_tag_image_set DROP FOREIGN KEY FK_EBC72DA315CF3DD9');
$this->addSql('DROP TABLE image');
$this->addSql('DROP TABLE image_set');
$this->addSql('DROP TABLE image_set_image');
$this->addSql('DROP TABLE image_set_product');
$this->addSql('DROP TABLE image_tag');
$this->addSql('DROP TABLE image_tag_image');
$this->addSql('DROP TABLE image_tag_image_set');
$this->addSql('ALTER TABLE discount DROP amount');
$this->addSql('ALTER TABLE messenger_messages CHANGE body body LONGTEXT NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE headers headers LONGTEXT NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE queue_name queue_name VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE product CHANGE name name VARCHAR(255) DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE product_arca CHANGE cdar cdar VARCHAR(20) NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE tag CHANGE name name VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE user CHANGE username username VARCHAR(180) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE roles roles LONGTEXT NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:json)\', CHANGE password password VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`');
}
}