migrations/Version20200507144750.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 Version20200507144750 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  19.         $this->addSql('ALTER TABLE measurement_settings ADD strength_points JSON DEFAULT \'{}\' NOT NULL');
  20.         $this->addSql('ALTER TABLE measurement_settings ADD is_strength_points_per_channel BOOLEAN DEFAULT \'false\' NOT NULL');
  21.         $this->addSql('COMMENT ON COLUMN measurement_settings.strength_points IS \'Strength points.\'');
  22.         $this->addSql('COMMENT ON COLUMN measurement_settings.is_strength_points_per_channel IS \'Are strength points calculated per channel.\'');
  23.         $this->addSql('ALTER TABLE channel_settings DROP CONSTRAINT fk_92f5d36cee364bbd');
  24.         $this->addSql('DROP INDEX idx_92f5d36cee364bbd');
  25.         $this->addSql('ALTER TABLE channel_settings ADD strength_points JSON DEFAULT \'{}\' NOT NULL');
  26.         $this->addSql('ALTER TABLE channel_settings DROP strength_point_setting_id');
  27.         $this->addSql('COMMENT ON COLUMN channel_settings.strength_points IS \'Strength points.\'');
  28.     }
  29.     public function down(Schema $schema) : void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  33.         $this->addSql('CREATE SCHEMA public');
  34.         $this->addSql('ALTER TABLE measurement_settings DROP strength_points');
  35.         $this->addSql('ALTER TABLE measurement_settings DROP is_strength_points_per_channel');
  36.         $this->addSql('ALTER TABLE channel_settings ADD strength_point_setting_id INT DEFAULT NULL');
  37.         $this->addSql('ALTER TABLE channel_settings DROP strength_points');
  38.         $this->addSql('ALTER TABLE channel_settings ADD CONSTRAINT fk_92f5d36cee364bbd FOREIGN KEY (strength_point_setting_id) REFERENCES strength_point_setting (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  39.         $this->addSql('CREATE INDEX idx_92f5d36cee364bbd ON channel_settings (strength_point_setting_id)');
  40.     }
  41. }