migrations/Version20260525120000.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 Version20260525120000 extends AbstractMigration
  6. {
  7.     public function getDescription(): string
  8.     {
  9.         return 'Make automatic MPa chart indicators off by default.';
  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 ALTER is_automatic_strength_points_enabled SET DEFAULT FALSE');
  15.         $this->addSql('UPDATE measurement_settings SET is_automatic_strength_points_enabled = FALSE WHERE is_automatic_strength_points_enabled = TRUE');
  16.     }
  17.     public function down(Schema $schema): void
  18.     {
  19.         $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on postgresql.');
  20.         $this->addSql('ALTER TABLE measurement_settings ALTER is_automatic_strength_points_enabled SET DEFAULT TRUE');
  21.     }
  22. }