<?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 Version20250902185615 extends AbstractMigration
{
public function getDescription(): string
{
return 'Crear tabla requisitos_tramite_drupal para almacenar requisitos de trĂ¡mites';
}
public function up(Schema $schema): void
{
// Crear tabla requisitos_tramite_drupal
$this->addSql('CREATE TABLE requisitos_tramite_drupal (
id INT AUTO_INCREMENT NOT NULL,
tramite_drupal_id INT NOT NULL,
title VARCHAR(255) DEFAULT NULL,
subtitulo VARCHAR(255) DEFAULT NULL,
descripcion LONGTEXT DEFAULT NULL,
orden INT NOT NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
PRIMARY KEY(id),
INDEX IDX_TRAMITE_DRUPAL (tramite_drupal_id),
INDEX IDX_ORDEN (orden)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
// Agregar foreign key constraint
$this->addSql('ALTER TABLE requisitos_tramite_drupal
ADD CONSTRAINT FK_REQUISITOS_TRAMITE_DRUPAL
FOREIGN KEY (tramite_drupal_id) REFERENCES tramite_drupal (id)
ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// Eliminar tabla requisitos_tramite_drupal
$this->addSql('DROP TABLE IF EXISTS requisitos_tramite_drupal');
}
}