<?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 Version20240423210751 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 category (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) NOT NULL, sort_order INT DEFAULT NULL, created_at DATETIME NOT NULL, modified_at DATETIME NOT NULL, INDEX idx_name (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE ws_document ADD category_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', DROP type');
$this->addSql('ALTER TABLE ws_document ADD CONSTRAINT FK_B14013BF12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_B14013BF12469DE2 ON ws_document (category_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ws_document DROP FOREIGN KEY FK_B14013BF12469DE2');
$this->addSql('DROP TABLE category');
$this->addSql('DROP INDEX IDX_B14013BF12469DE2 ON ws_document');
$this->addSql('ALTER TABLE ws_document ADD type VARCHAR(255) DEFAULT NULL, DROP category_id');
}
}