migrations/Version20251031140124.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use App\Utils\CommonFunctions;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8.  * Migración para insertar colores por defecto en la tabla color
  9.  */
  10. final class Version20251031140124 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return 'Inserción de colores por defecto para Header, Aside y Secciones';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         // Insertar colores por defecto desde archivo SQL
  19.         $this->addSql(CommonFunctions::getFile(__DIR__ '/Data/insert_colores_default.sql'));
  20.     }
  21.     public function down(Schema $schema): void
  22.     {
  23.         // Eliminar los colores insertados
  24.         $this->addSql("DELETE FROM color WHERE clase IN (
  25.             'bg-content-hero-cyan',
  26.             'bg-content-hero-sky',
  27.             'bg-content-hero-yellow',
  28.             'bg-content-hero-purple',
  29.             'bg-content-hero-blue',
  30.             'bg-content-hero-red',
  31.             'bg-aside-hero-dark',
  32.             'bg-aside-hero-light',
  33.             'bg-white',
  34.             'bg-light'
  35.         )");
  36.     }
  37. }