migrations/Version20250902185615.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20250902185615 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Crear tabla requisitos_tramite_drupal para almacenar requisitos de trĂ¡mites';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // Crear tabla requisitos_tramite_drupal
  18.         $this->addSql('CREATE TABLE requisitos_tramite_drupal (
  19.             id INT AUTO_INCREMENT NOT NULL,
  20.             tramite_drupal_id INT NOT NULL,
  21.             title VARCHAR(255) DEFAULT NULL,
  22.             subtitulo VARCHAR(255) DEFAULT NULL,
  23.             descripcion LONGTEXT DEFAULT NULL,
  24.             orden INT NOT NULL,
  25.             created_at DATETIME NOT NULL,
  26.             updated_at DATETIME NOT NULL,
  27.             PRIMARY KEY(id),
  28.             INDEX IDX_TRAMITE_DRUPAL (tramite_drupal_id),
  29.             INDEX IDX_ORDEN (orden)
  30.         ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  31.         // Agregar foreign key constraint
  32.         $this->addSql('ALTER TABLE requisitos_tramite_drupal 
  33.             ADD CONSTRAINT FK_REQUISITOS_TRAMITE_DRUPAL 
  34.             FOREIGN KEY (tramite_drupal_id) REFERENCES tramite_drupal (id) 
  35.             ON DELETE CASCADE');
  36.     }
  37.     public function down(Schema $schema): void
  38.     {
  39.         // Eliminar tabla requisitos_tramite_drupal
  40.         $this->addSql('DROP TABLE IF EXISTS requisitos_tramite_drupal');
  41.     }
  42. }