<?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 Version20251120135541 extends AbstractMigration
{
public function getDescription(): string
{
return 'Agrega foreign key con ON DELETE CASCADE en tipo_destacado.categoria_id';
}
public function up(Schema $schema): void
{
// Agregar foreign key con ON DELETE CASCADE
$this->addSql('ALTER TABLE tipo_destacado
ADD CONSTRAINT FK_TIPO_DESTACADO_CATEGORIA
FOREIGN KEY (categoria_id)
REFERENCES categoria (id)
ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// Eliminar foreign key
$this->addSql('ALTER TABLE tipo_destacado
DROP FOREIGN KEY FK_TIPO_DESTACADO_CATEGORIA');
}
}