migrations/Version20260424100000.php line 1

Open in your IDE?
  1. <?php
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. final class Version20260424100000 extends AbstractMigration
  6. {
  7.     public function getDescription(): string
  8.     {
  9.         return 'Add temperature split view settings for measurements and channels.';
  10.     }
  11.     public function up(Schema $schema): void
  12.     {
  13.         $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on postgresql.');
  14.         $this->addSql("ALTER TABLE measurement_settings ADD is_temperature_split_view BOOLEAN DEFAULT FALSE NOT NULL");
  15.         $this->addSql("COMMENT ON COLUMN measurement_settings.is_temperature_split_view IS 'Is temperature chart split into two diagrams'");
  16.         $this->addSql("ALTER TABLE channel_settings ADD diagram_group INT DEFAULT 1 NOT NULL");
  17.         $this->addSql("COMMENT ON COLUMN channel_settings.diagram_group IS 'Temperature diagram group.'");
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on postgresql.');
  22.         $this->addSql('ALTER TABLE channel_settings DROP diagram_group');
  23.         $this->addSql('ALTER TABLE measurement_settings DROP is_temperature_split_view');
  24.     }
  25. }