<?php
declare(strict_types=1);
namespace TicketsBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20240522145914 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE tickets_bundle__tag (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(30) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_C53A09E2B03A8386 (created_by_id), INDEX IDX_C53A09E2896DBBDE (updated_by_id), INDEX IDX_C53A09E2C76F1F52 (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 tickets_bundle__tag_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_9BD31EC0232D562B (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 tickets_bundle__ticket_tag (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', tag_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', ticket_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_9B09AE5BAD26311 (tag_id), INDEX IDX_9B09AE5700047D2 (ticket_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE tickets_bundle__tag ADD CONSTRAINT FK_C53A09E2B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE tickets_bundle__tag ADD CONSTRAINT FK_C53A09E2896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE tickets_bundle__tag ADD CONSTRAINT FK_C53A09E2C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE tickets_bundle__tag_translations ADD CONSTRAINT FK_9BD31EC0232D562B FOREIGN KEY (object_id) REFERENCES tickets_bundle__tag (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE tickets_bundle__ticket_tag ADD CONSTRAINT FK_9B09AE5BAD26311 FOREIGN KEY (tag_id) REFERENCES tickets_bundle__tag (id)');
$this->addSql('ALTER TABLE tickets_bundle__ticket_tag ADD CONSTRAINT FK_9B09AE5700047D2 FOREIGN KEY (ticket_id) REFERENCES tickets_bundle__ticket (id)');
$this->addSql('ALTER TABLE tickets_bundle__ticket_tag ADD is_active TINYINT(1) DEFAULT 1 NOT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE tickets_bundle__tag DROP FOREIGN KEY FK_C53A09E2B03A8386');
$this->addSql('ALTER TABLE tickets_bundle__tag DROP FOREIGN KEY FK_C53A09E2896DBBDE');
$this->addSql('ALTER TABLE tickets_bundle__tag DROP FOREIGN KEY FK_C53A09E2C76F1F52');
$this->addSql('ALTER TABLE tickets_bundle__tag_translations DROP FOREIGN KEY FK_9BD31EC0232D562B');
$this->addSql('ALTER TABLE tickets_bundle__ticket_tag DROP FOREIGN KEY FK_9B09AE5BAD26311');
$this->addSql('ALTER TABLE tickets_bundle__ticket_tag DROP FOREIGN KEY FK_9B09AE5700047D2');
$this->addSql('DROP TABLE tickets_bundle__tag');
$this->addSql('DROP TABLE tickets_bundle__tag_translations');
$this->addSql('DROP TABLE tickets_bundle__ticket_tag');
$this->addSql('ALTER TABLE tickets_bundle__ticket_tag DROP is_active');
}
}