migrations/Version20250715152739.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 Version20250715152739 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Crea la tabla destacados con relaciones a categoria y tramite';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql('CREATE TABLE destacado (
  18.             id INT AUTO_INCREMENT NOT NULL,
  19.             tipo_destacado_id INT NOT NULL,
  20.             tramite_id INT NOT NULL,
  21.             posicion INT NOT NULL,
  22.             INDEX FK_TIPO_DESTACADO (tipo_destacado_id),
  23.             INDEX IDX_TRAMITE (tramite_id),
  24.             PRIMARY KEY(id),
  25.             CONSTRAINT FK_TIPO_DESTACADO FOREIGN KEY (tipo_destacado_id) REFERENCES tipo_destacado (id) ON DELETE CASCADE,
  26.             CONSTRAINT FK_TRAMITE FOREIGN KEY (tramite_id) REFERENCES tramite (id) ON DELETE CASCADE
  27.         ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         $this->addSql('DROP TABLE destacado');
  32.     }
  33. }