<?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 Version20250715152739 extends AbstractMigration
{
public function getDescription(): string
{
return 'Crea la tabla destacados con relaciones a categoria y tramite';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE destacado (
id INT AUTO_INCREMENT NOT NULL,
tipo_destacado_id INT NOT NULL,
tramite_id INT NOT NULL,
posicion INT NOT NULL,
INDEX FK_TIPO_DESTACADO (tipo_destacado_id),
INDEX IDX_TRAMITE (tramite_id),
PRIMARY KEY(id),
CONSTRAINT FK_TIPO_DESTACADO FOREIGN KEY (tipo_destacado_id) REFERENCES tipo_destacado (id) ON DELETE CASCADE,
CONSTRAINT FK_TRAMITE FOREIGN KEY (tramite_id) REFERENCES tramite (id) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE destacado');
}
}