<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200507144750 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE measurement_settings ADD strength_points JSON DEFAULT \'{}\' NOT NULL');
$this->addSql('ALTER TABLE measurement_settings ADD is_strength_points_per_channel BOOLEAN DEFAULT \'false\' NOT NULL');
$this->addSql('COMMENT ON COLUMN measurement_settings.strength_points IS \'Strength points.\'');
$this->addSql('COMMENT ON COLUMN measurement_settings.is_strength_points_per_channel IS \'Are strength points calculated per channel.\'');
$this->addSql('ALTER TABLE channel_settings DROP CONSTRAINT fk_92f5d36cee364bbd');
$this->addSql('DROP INDEX idx_92f5d36cee364bbd');
$this->addSql('ALTER TABLE channel_settings ADD strength_points JSON DEFAULT \'{}\' NOT NULL');
$this->addSql('ALTER TABLE channel_settings DROP strength_point_setting_id');
$this->addSql('COMMENT ON COLUMN channel_settings.strength_points IS \'Strength points.\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE measurement_settings DROP strength_points');
$this->addSql('ALTER TABLE measurement_settings DROP is_strength_points_per_channel');
$this->addSql('ALTER TABLE channel_settings ADD strength_point_setting_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE channel_settings DROP strength_points');
$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');
$this->addSql('CREATE INDEX idx_92f5d36cee364bbd ON channel_settings (strength_point_setting_id)');
}
}