<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250107114818 extends AbstractMigration
{
public function getDescription(): string
{
return 'Delete on cascade to purge database when loading fixtures';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE category DROP FOREIGN KEY FK_64C19C1727ACA70');
$this->addSql('ALTER TABLE category ADD CONSTRAINT FK_64C19C1727ACA70 FOREIGN KEY (parent_id) REFERENCES category (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE category DROP FOREIGN KEY FK_64C19C1727ACA70');
$this->addSql('ALTER TABLE category ADD CONSTRAINT FK_64C19C1727ACA70 FOREIGN KEY (parent_id) REFERENCES category (id)');
}
}